用户购水卡和用户充值卡账单明细的逻辑实现
This commit is contained in:
@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fastbee.rechargecard.mapper.UserConsumptionDetailsMapper">
|
||||
|
||||
<resultMap type="UserConsumptionDetails" id="UserConsumptionDetailsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="deviceNumber" column="device_number" />
|
||||
<result property="cardNumber" column="card_number" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="billingType" column="billing_type" />
|
||||
<result property="pumpTime" column="pump_time" />
|
||||
<result property="unitPrice" column="unit_price" />
|
||||
<result property="totalPrice" column="total_price" />
|
||||
<result property="discount" column="discount" />
|
||||
<result property="taxAmount" column="tax_amount" />
|
||||
<result property="amountDue" column="amount_due" />
|
||||
<result property="billingPeriodUnit" column="billing_period_unit" />
|
||||
<result property="billingPeriodDuration" column="billing_period_duration" />
|
||||
<result property="billingDate" column="billing_date" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="paymentStatus" column="payment_status" />
|
||||
<result property="paymentMethod" column="payment_method" />
|
||||
<result property="paymentTime" column="payment_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserConsumptionDetailsVo">
|
||||
select id, user_id, device_number, card_number, project_id, dept_id, billing_type, pump_time, unit_price, total_price, discount, tax_amount, amount_due, billing_period_unit, billing_period_duration, billing_date, start_time, end_time, payment_status, payment_method, payment_time, status, remarks, create_time, update_time, create_by, update_by from user_consumption_details
|
||||
</sql>
|
||||
|
||||
<select id="selectUserConsumptionDetailsList" parameterType="UserConsumptionDetails" resultMap="UserConsumptionDetailsResult">
|
||||
<include refid="selectUserConsumptionDetailsVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="billingType != null "> and billing_type = #{billingType}</if>
|
||||
<if test="pumpTime != null "> and pump_time = #{pumpTime}</if>
|
||||
<if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
|
||||
<if test="totalPrice != null "> and total_price = #{totalPrice}</if>
|
||||
<if test="discount != null "> and discount = #{discount}</if>
|
||||
<if test="taxAmount != null "> and tax_amount = #{taxAmount}</if>
|
||||
<if test="amountDue != null "> and amount_due = #{amountDue}</if>
|
||||
<if test="billingPeriodUnit != null "> and billing_period_unit = #{billingPeriodUnit}</if>
|
||||
<if test="billingPeriodDuration != null "> and billing_period_duration = #{billingPeriodDuration}</if>
|
||||
<if test="billingDate != null "> and billing_date = #{billingDate}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="paymentStatus != null "> and payment_status = #{paymentStatus}</if>
|
||||
<if test="paymentMethod != null "> and payment_method = #{paymentMethod}</if>
|
||||
<if test="paymentTime != null "> and payment_time = #{paymentTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserConsumptionDetailsById" parameterType="Long" resultMap="UserConsumptionDetailsResult">
|
||||
<include refid="selectUserConsumptionDetailsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectUserConsumptionDetailsListById" parameterType="String" resultMap="UserConsumptionDetailsResult">
|
||||
<include refid="selectUserConsumptionDetailsVo"/>
|
||||
<where>
|
||||
card_number=#{cardNumber}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertUserConsumptionDetails" parameterType="UserConsumptionDetails" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_consumption_details
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deviceNumber != null">device_number,</if>
|
||||
<if test="cardNumber != null">card_number,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="billingType != null">billing_type,</if>
|
||||
<if test="pumpTime != null">pump_time,</if>
|
||||
<if test="unitPrice != null">unit_price,</if>
|
||||
<if test="totalPrice != null">total_price,</if>
|
||||
<if test="discount != null">discount,</if>
|
||||
<if test="taxAmount != null">tax_amount,</if>
|
||||
<if test="amountDue != null">amount_due,</if>
|
||||
<if test="billingPeriodUnit != null">billing_period_unit,</if>
|
||||
<if test="billingPeriodDuration != null">billing_period_duration,</if>
|
||||
<if test="billingDate != null">billing_date,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="paymentStatus != null">payment_status,</if>
|
||||
<if test="paymentMethod != null">payment_method,</if>
|
||||
<if test="paymentTime != null">payment_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remarks != null">remarks,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deviceNumber != null">#{deviceNumber},</if>
|
||||
<if test="cardNumber != null">#{cardNumber},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="billingType != null">#{billingType},</if>
|
||||
<if test="pumpTime != null">#{pumpTime},</if>
|
||||
<if test="unitPrice != null">#{unitPrice},</if>
|
||||
<if test="totalPrice != null">#{totalPrice},</if>
|
||||
<if test="discount != null">#{discount},</if>
|
||||
<if test="taxAmount != null">#{taxAmount},</if>
|
||||
<if test="amountDue != null">#{amountDue},</if>
|
||||
<if test="billingPeriodUnit != null">#{billingPeriodUnit},</if>
|
||||
<if test="billingPeriodDuration != null">#{billingPeriodDuration},</if>
|
||||
<if test="billingDate != null">#{billingDate},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="paymentStatus != null">#{paymentStatus},</if>
|
||||
<if test="paymentMethod != null">#{paymentMethod},</if>
|
||||
<if test="paymentTime != null">#{paymentTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remarks != null">#{remarks},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserConsumptionDetails" parameterType="UserConsumptionDetails">
|
||||
update user_consumption_details
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="deviceNumber != null">device_number = #{deviceNumber},</if>
|
||||
<if test="cardNumber != null">card_number = #{cardNumber},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="billingType != null">billing_type = #{billingType},</if>
|
||||
<if test="pumpTime != null">pump_time = #{pumpTime},</if>
|
||||
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
|
||||
<if test="totalPrice != null">total_price = #{totalPrice},</if>
|
||||
<if test="discount != null">discount = #{discount},</if>
|
||||
<if test="taxAmount != null">tax_amount = #{taxAmount},</if>
|
||||
<if test="amountDue != null">amount_due = #{amountDue},</if>
|
||||
<if test="billingPeriodUnit != null">billing_period_unit = #{billingPeriodUnit},</if>
|
||||
<if test="billingPeriodDuration != null">billing_period_duration = #{billingPeriodDuration},</if>
|
||||
<if test="billingDate != null">billing_date = #{billingDate},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="paymentStatus != null">payment_status = #{paymentStatus},</if>
|
||||
<if test="paymentMethod != null">payment_method = #{paymentMethod},</if>
|
||||
<if test="paymentTime != null">payment_time = #{paymentTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remarks != null">remarks = #{remarks},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserConsumptionDetailsById" parameterType="Long">
|
||||
delete from user_consumption_details where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserConsumptionDetailsByIds" parameterType="String">
|
||||
delete from user_consumption_details where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fastbee.rechargecard.mapper.UserRechargeCardsMapper">
|
||||
|
||||
<resultMap type="UserRechargeCards" id="UserRechargeCardsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="name" column="name" />
|
||||
<result property="phone" column="phone" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="balance" column="balance" />
|
||||
<result property="cardNumber" column="card_number" />
|
||||
<result property="cardPassword" column="card_password" />
|
||||
<result property="issueDate" column="issue_date" />
|
||||
<result property="expirationDate" column="expiration_date" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="userId" column="user_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserRechargeCardsVo">
|
||||
select id, user_name, name, phone, project_id, dept_id, balance, card_number, card_password, issue_date, expiration_date, status, create_time, update_time, create_by, update_by, del_flag, user_id from user_recharge_cards
|
||||
</sql>
|
||||
|
||||
<select id="selectUserRechargeCardsList" parameterType="UserRechargeCards" resultMap="UserRechargeCardsResult">
|
||||
<include refid="selectUserRechargeCardsVo"/>
|
||||
<where>
|
||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
||||
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="balance != null "> and balance = #{balance}</if>
|
||||
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
|
||||
<if test="cardPassword != null and cardPassword != ''"> and card_password = #{cardPassword}</if>
|
||||
<if test="issueDate != null "> and issue_date = #{issueDate}</if>
|
||||
<if test="expirationDate != null "> and expiration_date = #{expirationDate}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserRechargeCardsById" parameterType="Long" resultMap="UserRechargeCardsResult">
|
||||
<include refid="selectUserRechargeCardsVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserRechargeCards" parameterType="UserRechargeCards" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_recharge_cards
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">user_name,</if>
|
||||
<if test="name != null">name,</if>
|
||||
<if test="phone != null">phone,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="balance != null">balance,</if>
|
||||
<if test="cardNumber != null">card_number,</if>
|
||||
<if test="cardPassword != null">card_password,</if>
|
||||
<if test="issueDate != null">issue_date,</if>
|
||||
<if test="expirationDate != null">expiration_date,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userName != null">#{userName},</if>
|
||||
<if test="name != null">#{name},</if>
|
||||
<if test="phone != null">#{phone},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="balance != null">#{balance},</if>
|
||||
<if test="cardNumber != null">#{cardNumber},</if>
|
||||
<if test="cardPassword != null">#{cardPassword},</if>
|
||||
<if test="issueDate != null">#{issueDate},</if>
|
||||
<if test="expirationDate != null">#{expirationDate},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserRechargeCards" parameterType="UserRechargeCards">
|
||||
update user_recharge_cards
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userName != null">user_name = #{userName},</if>
|
||||
<if test="name != null">name = #{name},</if>
|
||||
<if test="phone != null">phone = #{phone},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="balance != null">balance = #{balance},</if>
|
||||
<if test="cardNumber != null">card_number = #{cardNumber},</if>
|
||||
<if test="cardPassword != null">card_password = #{cardPassword},</if>
|
||||
<if test="issueDate != null">issue_date = #{issueDate},</if>
|
||||
<if test="expirationDate != null">expiration_date = #{expirationDate},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserRechargeCardsById" parameterType="Long">
|
||||
delete from user_recharge_cards where user_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserRechargeCardsByIds" parameterType="String">
|
||||
delete from user_recharge_cards where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user