You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sdny-order/order-management-base-service/src/main/resources/mybatis/mapper/CommodityCodeModifyLogDao.xml

108 lines
4.5 KiB

<?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.dxhy.order.baseservice.module.commodity.dao.CommodityCodeModifyLogDao">
<resultMap type="com.dxhy.order.baseservice.module.commodity.model.CommodityCodeModifyLog" id="CommodityCodeModifyLogMap">
<result property="id" column="id" jdbcType="VARCHAR"/>
<result property="commodityCodeId" column="commodity_code_id" jdbcType="VARCHAR"/>
<result property="key" column="key" jdbcType="VARCHAR"/>
<result property="originValue" column="origin_value" jdbcType="VARCHAR"/>
<result property="newValue" column="new_value" jdbcType="VARCHAR"/>
<result property="modifyUserId" column="modify_user_id" jdbcType="VARCHAR"/>
<result property="modifyTime" column="modify_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="CommodityCodeModifyLogMap">
select
id, commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time
from commodity_code_modify_log
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="CommodityCodeModifyLogMap">
select
id, commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time
from commodity_code_modify_log
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="CommodityCodeModifyLogMap">
select
id, commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time
from commodity_code_modify_log
<where>
<if test="id != null and id != ''">
and id = #{id}
</if>
<if test="commodityCodeId != null and commodityCodeId != ''">
and commodity_code_id = #{commodityCodeId}
</if>
<if test="key != null and key != ''">
and `key` = #{key}
</if>
<if test="originValue != null and originValue != ''">
and origin_value = #{originValue}
</if>
<if test="newValue != null and newValue != ''">
and new_value = #{newValue}
</if>
<if test="modifyUserId != null and modifyUserId != ''">
and modify_user_id = #{modifyUserId}
</if>
<if test="modifyTime != null">
and modify_time = #{modifyTime}
</if>
</where>
order by modify_time asc limit 1
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into commodity_code_modify_log(commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time)
values (#{commodityCodeId}, #{key}, #{originValue}, #{newValue}, #{modifyUserId}, #{modifyTime})
</insert>
<!--新增所有列-->
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
insert into commodity_code_modify_log(id,commodity_code_id, `key`, origin_value, new_value, modify_user_id, modify_time)
values
<foreach collection="list" item="item" index="index" separator=",">
(#{item.id}, #{item.commodityCodeId}, #{item.key}, #{item.originValue}, #{item.newValue}, #{item.modifyUserId}, #{item.modifyTime})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update commodity_code_modify_log
<set>
<if test="commodityCodeId != null and commodityCodeId != ''">
commodity_code_id = #{commodityCodeId},
</if>
<if test="key != null and key != ''">
`key` = #{key},
</if>
<if test="originValue != null and originValue != ''">
origin_value = #{originValue},
</if>
<if test="newValue != null and newValue != ''">
new_value = #{newValue},
</if>
<if test="modifyUserId != null and modifyUserId != ''">
modify_user_id = #{modifyUserId},
</if>
<if test="modifyTime != null">
modify_time = #{modifyTime},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from commodity_code_modify_log where id = #{id}
</delete>
</mapper>