javacodeadmin/ruoyi-system/src/main/resources/mapper/system/WorkerMarginLogMapper.xml

81 lines
3.4 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.ruoyi.system.mapper.WorkerMarginLogMapper">
<resultMap type="WorkerMarginLog" id="WorkerMarginLogResult">
<result property="id" column="id" />
<result property="uid" column="uid" />
<result property="oid" column="oid" />
<result property="orderId" column="order_id" />
<result property="price" column="price" />
<result property="createdAt" column="created_at" />
<result property="updatedAt" column="updated_at" />
</resultMap>
<sql id="selectWorkerMarginLogVo">
select id, uid, oid, order_id, price, created_at, updated_at from worker_margin_log
</sql>
<select id="selectWorkerMarginLogList" parameterType="WorkerMarginLog" resultMap="WorkerMarginLogResult">
<include refid="selectWorkerMarginLogVo"/>
<where>
<if test="uid != null "> and uid = #{uid}</if>
<if test="oid != null "> and oid = #{oid}</if>
<if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
<if test="price != null "> and price = #{price}</if>
<if test="createdAt != null "> and created_at = #{createdAt}</if>
<if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
</where>
order by id desc
</select>
<select id="selectWorkerMarginLogById" parameterType="Integer" resultMap="WorkerMarginLogResult">
<include refid="selectWorkerMarginLogVo"/>
where id = #{id}
</select>
<insert id="insertWorkerMarginLog" parameterType="WorkerMarginLog" useGeneratedKeys="true" keyProperty="id">
insert into worker_margin_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">uid,</if>
<if test="oid != null">oid,</if>
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="price != null">price,</if>
created_at,
updated_at
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uid != null">#{uid},</if>
<if test="oid != null">#{oid},</if>
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="price != null">#{price},</if>
NOW(),
NOW()
</trim>
</insert>
<update id="updateWorkerMarginLog" parameterType="WorkerMarginLog">
update worker_margin_log
<trim prefix="SET" suffixOverrides=",">
<if test="uid != null">uid = #{uid},</if>
<if test="oid != null">oid = #{oid},</if>
<if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
<if test="price != null">price = #{price},</if>
updated_at = NOW()
</trim>
where id = #{id}
</update>
<delete id="deleteWorkerMarginLogById" parameterType="Integer">
delete from worker_margin_log where id = #{id}
</delete>
<delete id="deleteWorkerMarginLogByIds" parameterType="String">
delete from worker_margin_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>