178 lines
10 KiB
XML
178 lines
10 KiB
XML
<?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.bonus.canteen.core.account.mapper.AccCardMapper">
|
|
<resultMap type="com.bonus.canteen.core.account.domain.AccCard" id="AccCardResult">
|
|
<result property="id" column="id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="nickName" column="nick_name" />
|
|
<result property="accId" column="acc_id" />
|
|
<result property="cardNum" column="card_num" />
|
|
<result property="serialNum" column="serial_num" />
|
|
<result property="cardNature" column="card_nature" />
|
|
<result property="cardType" column="card_type" />
|
|
<result property="cardStatus" column="card_status" />
|
|
<result property="deposit" column="deposit" />
|
|
<result property="productCost" column="product_cost" />
|
|
<result property="pendProductCost" column="pend_product_cost" />
|
|
<result property="validityDate" column="validity_date" />
|
|
<result property="remark" column="remark" />
|
|
<result property="cardFaceNum" column="card_face_num" />
|
|
<result property="revision" column="revision" />
|
|
<result property="reserved1" column="reserved1" />
|
|
<result property="reserved2" column="reserved2" />
|
|
<result property="reserved3" column="reserved3" />
|
|
<result property="thirdSerialNum" column="third_serial_num" />
|
|
<result property="cardSourceType" column="card_source_type" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAccCardVo">
|
|
select ac.id, ac.user_id, ac.acc_id, ac.card_num, ac.serial_num, ac.card_nature, ac.card_type, ac.card_status, ac.deposit,
|
|
ac.product_cost, ac.pend_product_cost, ac.validity_date, ac.remark, ac.card_face_num, ac.revision, ac.reserved1,
|
|
ac.reserved2, ac.reserved3, ac.third_serial_num, ac.card_source_type, ac.create_by, ac.create_time, ac.update_by,
|
|
ac.update_time, su.nick_name
|
|
from acc_card ac
|
|
left join sys_user su on su.user_id = ac.user_id
|
|
</sql>
|
|
|
|
<select id="selectAccCardList" parameterType="com.bonus.canteen.core.account.domain.AccCard" resultMap="AccCardResult">
|
|
<include refid="selectAccCardVo"/>
|
|
<where>
|
|
ac.card_status in (1,4,5)
|
|
<if test="userId != null "> and ac.user_id = #{userId}</if>
|
|
<if test="accId != null "> and ac.acc_id = #{accId}</if>
|
|
<if test="cardNum != null "> and ac.card_num = #{cardNum}</if>
|
|
<if test="serialNum != null and serialNum != ''"> and ac.serial_num = #{serialNum}</if>
|
|
<if test="cardNature != null and cardNature != ''"> and ac.card_nature = #{cardNature}</if>
|
|
<if test="cardType != null "> and ac.card_type = #{cardType}</if>
|
|
<if test="deposit != null "> and ac.deposit = #{deposit}</if>
|
|
<if test="productCost != null "> and ac.product_cost = #{productCost}</if>
|
|
<if test="pendProductCost != null "> and ac.pend_product_cost = #{pendProductCost}</if>
|
|
<if test="validityDate != null "> and ac.validity_date = #{validityDate}</if>
|
|
<if test="cardFaceNum != null and cardFaceNum != ''"> and ac.card_face_num = #{cardFaceNum}</if>
|
|
<if test="revision != null "> and ac.revision = #{revision}</if>
|
|
<if test="reserved1 != null and reserved1 != ''"> and ac.reserved1 = #{reserved1}</if>
|
|
<if test="reserved2 != null and reserved2 != ''"> and ac.reserved2 = #{reserved2}</if>
|
|
<if test="reserved3 != null and reserved3 != ''"> and ac.reserved3 = #{reserved3}</if>
|
|
<if test="thirdSerialNum != null and thirdSerialNum != ''"> and ac.third_serial_num = #{thirdSerialNum}</if>
|
|
<if test="cardSourceType != null and cardSourceType != ''"> and ac.card_source_type = #{cardSourceType}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectAccCardCountByUserId" parameterType="Long" resultType="Integer">
|
|
select count(1)
|
|
from acc_card
|
|
where user_id = #{userId} and card_status in (1,4,5)
|
|
</select>
|
|
|
|
<select id="selectAccCardCountByCardSerialNum" parameterType="String" resultType="Integer">
|
|
select count(1)
|
|
from acc_card
|
|
where serial_num = #{serialNum}
|
|
</select>
|
|
|
|
<select id="selectAccCardById" parameterType="Long" resultMap="AccCardResult">
|
|
<include refid="selectAccCardVo"/>
|
|
where ac.id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAccCard" parameterType="com.bonus.canteen.core.account.domain.AccCard" useGeneratedKeys="true" keyProperty="id">
|
|
insert into acc_card
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="accId != null">acc_id,</if>
|
|
<if test="cardNum != null">card_num,</if>
|
|
<if test="serialNum != null and serialNum != ''">serial_num,</if>
|
|
<if test="cardNature != null">card_nature,</if>
|
|
<if test="cardType != null">card_type,</if>
|
|
<if test="cardStatus != null">card_status,</if>
|
|
<if test="deposit != null">deposit,</if>
|
|
<if test="productCost != null">product_cost,</if>
|
|
<if test="pendProductCost != null">pend_product_cost,</if>
|
|
<if test="validityDate != null">validity_date,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="cardFaceNum != null">card_face_num,</if>
|
|
<if test="revision != null">revision,</if>
|
|
<if test="reserved1 != null">reserved1,</if>
|
|
<if test="reserved2 != null">reserved2,</if>
|
|
<if test="reserved3 != null">reserved3,</if>
|
|
<if test="thirdSerialNum != null">third_serial_num,</if>
|
|
<if test="cardSourceType != null">card_source_type,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="accId != null">#{accId},</if>
|
|
<if test="cardNum != null">#{cardNum},</if>
|
|
<if test="serialNum != null and serialNum != ''">#{serialNum},</if>
|
|
<if test="cardNature != null">#{cardNature},</if>
|
|
<if test="cardType != null">#{cardType},</if>
|
|
<if test="cardStatus != null">#{cardStatus},</if>
|
|
<if test="deposit != null">#{deposit},</if>
|
|
<if test="productCost != null">#{productCost},</if>
|
|
<if test="pendProductCost != null">#{pendProductCost},</if>
|
|
<if test="validityDate != null">#{validityDate},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="cardFaceNum != null">#{cardFaceNum},</if>
|
|
<if test="revision != null">#{revision},</if>
|
|
<if test="reserved1 != null">#{reserved1},</if>
|
|
<if test="reserved2 != null">#{reserved2},</if>
|
|
<if test="reserved3 != null">#{reserved3},</if>
|
|
<if test="thirdSerialNum != null">#{thirdSerialNum},</if>
|
|
<if test="cardSourceType != null">#{cardSourceType},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAccCard" parameterType="com.bonus.canteen.core.account.domain.AccCard">
|
|
update acc_card
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="accId != null">acc_id = #{accId},</if>
|
|
<if test="cardNum != null">card_num = #{cardNum},</if>
|
|
<if test="serialNum != null and serialNum != ''">serial_num = #{serialNum},</if>
|
|
<if test="cardNature != null">card_nature = #{cardNature},</if>
|
|
<if test="cardType != null">card_type = #{cardType},</if>
|
|
<if test="cardStatus != null">card_status = #{cardStatus},</if>
|
|
<if test="deposit != null">deposit = #{deposit},</if>
|
|
<if test="productCost != null">product_cost = #{productCost},</if>
|
|
<if test="pendProductCost != null">pend_product_cost = #{pendProductCost},</if>
|
|
<if test="validityDate != null">validity_date = #{validityDate},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="cardFaceNum != null">card_face_num = #{cardFaceNum},</if>
|
|
<if test="revision != null">revision = #{revision},</if>
|
|
<if test="reserved1 != null">reserved1 = #{reserved1},</if>
|
|
<if test="reserved2 != null">reserved2 = #{reserved2},</if>
|
|
<if test="reserved3 != null">reserved3 = #{reserved3},</if>
|
|
<if test="thirdSerialNum != null">third_serial_num = #{thirdSerialNum},</if>
|
|
<if test="cardSourceType != null">card_source_type = #{cardSourceType},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where acc_id = #{accId}
|
|
</update>
|
|
|
|
<delete id="deleteAccCardById" parameterType="Long">
|
|
delete from acc_card where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAccCardByIds" parameterType="String">
|
|
delete from acc_card where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |