110 lines
4.1 KiB
XML
110 lines
4.1 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.lz.modules.luck.dao.LuckGoodsMapper">
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
<resultMap id="BaseResultMap" type="com.lz.modules.luck.entity.LuckGoods">
|
|
<id column="id" property="id"/>
|
|
<result column="is_delete" property="isDelete"/>
|
|
<result column="gmt_create" property="gmtCreate"/>
|
|
<result column="gmt_modified" property="gmtModified"/>
|
|
<result column="luck_id" property="luckId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="weight" property="weight"/>
|
|
<result column="remark" property="remark"/>
|
|
<result column="counts" property="counts"/>
|
|
<result column="is_finish" property="isFinish"/>
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
<sql id="Base_Column_List">
|
|
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, luck_id AS luckId, name AS name, weight AS weight, remark AS remark, counts AS counts, is_finish as isFinish
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectLuckGoodsById" resultType="LuckGoods" >
|
|
select * from luck_goods where id=#{id} and is_delete = 0 limit 1
|
|
</select>
|
|
|
|
|
|
<insert id="insertLuckGoods" parameterType="LuckGoods" useGeneratedKeys="true" keyProperty="id" >
|
|
insert into luck_goods(
|
|
<if test="luckId != null">luck_id, </if>
|
|
<if test="name != null">name, </if>
|
|
<if test="weight != null">weight, </if>
|
|
<if test="remark != null">remark, </if>
|
|
<if test="counts != null">counts, </if>
|
|
<if test="isFinish != null">is_finish, </if>
|
|
is_delete,
|
|
gmt_create,
|
|
gmt_modified
|
|
)values(
|
|
<if test="luckId != null">#{ luckId}, </if>
|
|
<if test="name != null">#{ name}, </if>
|
|
<if test="weight != null">#{ weight}, </if>
|
|
<if test="remark != null">#{ remark}, </if>
|
|
<if test="counts != null">#{ counts}, </if>
|
|
<if test="isFinish != null">#{ isFinish}, </if>
|
|
0,
|
|
now(),
|
|
now()
|
|
)
|
|
</insert>
|
|
|
|
|
|
<update id="updateLuckGoodsById" parameterType="LuckGoods" >
|
|
update
|
|
luck_goods
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
|
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
|
<if test="luckId != null">luck_id = #{luckId},</if>
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="weight != null">weight = #{weight},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="counts != null">counts = #{counts}</if>
|
|
<if test="isFinish != null">is_finish = #{isFinish}</if>
|
|
</trim>
|
|
,gmt_modified = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<update id="updateCoverLuckGoodsById" parameterType="LuckGoods" >
|
|
update
|
|
luck_goods
|
|
set
|
|
is_delete = #{isDelete},
|
|
gmt_create = #{gmtCreate},
|
|
luck_id = #{luckId},
|
|
name = #{name},
|
|
weight = #{weight},
|
|
remark = #{remark},
|
|
counts = #{counts},
|
|
is_finish = #{isFinish},
|
|
,gmt_modified = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
|
|
<update id="deleteLuckGoodsById" parameterType="java.lang.Long">
|
|
update luck_goods set is_delete = 1 where id=#{id} limit 1
|
|
</update>
|
|
|
|
<select id="getByLuckId" resultType="LuckGoods" >
|
|
select * from luck_goods where luck_id=#{luckId} and is_delete = 0 order by weight desc
|
|
</select>
|
|
|
|
<select id="selectNumGoodLuckRecordByLuckId" parameterType="java.lang.Long" resultType="integer">
|
|
select sum(counts) from luck_goods where luck_id=#{luckId} and is_delete = 0
|
|
</select>
|
|
|
|
<select id="getNoFinishByLuckId" resultType="LuckGoods" >
|
|
select * from luck_goods where luck_id=#{luckId} and is_delete = 0 and is_finish=0 order by weight desc
|
|
</select>
|
|
</mapper>
|
|
|