zhwl/zhwl-business/zhwl-printset/target/classes/mapper/ZdyPrintLogMapper.xml

221 lines
8.2 KiB
XML
Raw Permalink Normal View History

2025-07-01 17:54:58 +08:00
<?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.zhwl.printset.mapper.ZdyPrintLogMapper">
<resultMap type="ZdyPrintLog" id="ZdyPrintLogResult">
<result property="id" column="id"/>
<result property="ticketId" column="ticket_id"/>
<result property="orderId" column="order_id"/>
<result property="orderItemId" column="order_item_id"/>
<result property="orderDetailId" column="order_detail_id"/>
<result property="orderDetailChildId" column="order_detail_child_id"/>
<result property="printType" column="print_type"/>
<result property="printNum" column="print_num"/>
<result property="adminId" column="admin_id"/>
<result property="adminName" column="admin_name"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="createTime" column="create_time"/>
<result property="printStatus" column="print_status"/>
<result property="failMsg" column="fail_msg"/>
<result property="ticketName" column="ticket_name"/>
</resultMap>
<sql id="selectZdyPrintLogVo">
select id, ticket_id,ticket_name, order_id, order_item_id, order_detail_id, order_detail_child_id, print_type, print_num, admin_id, admin_name, user_id, user_name, create_time, print_status, fail_msg
from zdy_print_log
</sql>
<select id="selectZdyPrintLogList" parameterType="ZdyPrintLog" resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
<where>
<if test="ticketId != null ">
and ticket_id = #{ticketId}
</if>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="orderItemId != null ">
and order_item_id = #{orderItemId}
</if>
<if test="orderDetailId != null ">
and order_detail_id = #{orderDetailId}
</if>
<if test="orderDetailChildId != null ">
and order_detail_child_id = #{orderDetailChildId}
</if>
<if test="printType != null and printType != ''">
and print_type = #{printType}
</if>
<if test="printNum != null ">
and print_num = #{printNum}
</if>
<if test="adminId != null ">
and admin_id = #{adminId}
</if>
<if test="adminName != null and adminName != ''">
and admin_name like concat('%', #{adminName}, '%')
</if>
<if test="userId != null ">
and user_id = #{userId}
</if>
<if test="userName != null and userName != ''">
and user_name like concat('%', #{userName}, '%')
</if>
<if test="printStatus != null ">
and print_status = #{printStatus}
</if>
<if test="ticketName != null and ticketName != ''">
and ticket_name like concat('%', #{ticketName}, '%')
</if>
</where>
order by create_time desc
</select>
<select id="selectZdyPrintLogById" parameterType="Long"
resultMap="ZdyPrintLogResult">
<include refid="selectZdyPrintLogVo"/>
where id = #{id}
</select>
<insert id="insertZdyPrintLog" parameterType="ZdyPrintLog" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_print_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketId != null">ticket_id,
</if>
<if test="orderId != null">order_id,
</if>
<if test="orderItemId != null">order_item_id,
</if>
<if test="orderDetailId != null">order_detail_id,
</if>
<if test="orderDetailChildId != null">order_detail_child_id,
</if>
<if test="printType != null">print_type,
</if>
<if test="printNum != null">print_num,
</if>
<if test="adminId != null">admin_id,
</if>
<if test="adminName != null">admin_name,
</if>
<if test="userId != null">user_id,
</if>
<if test="userName != null">user_name,
</if>
<if test="createTime != null">create_time,
</if>
<if test="printStatus != null">print_status,
</if>
<if test="failMsg != null">fail_msg,
</if>
<if test="ticketName != null">ticket_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketId != null">#{ticketId},
</if>
<if test="orderId != null">#{orderId},
</if>
<if test="orderItemId != null">#{orderItemId},
</if>
<if test="orderDetailId != null">#{orderDetailId},
</if>
<if test="orderDetailChildId != null">#{orderDetailChildId},
</if>
<if test="printType != null">#{printType},
</if>
<if test="printNum != null">#{printNum},
</if>
<if test="adminId != null">#{adminId},
</if>
<if test="adminName != null">#{adminName},
</if>
<if test="userId != null">#{userId},
</if>
<if test="userName != null">#{userName},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="printStatus != null">#{printStatus},
</if>
<if test="failMsg != null">#{failMsg},
</if>
<if test="ticketName != null">#{ticketName},
</if>
</trim>
</insert>
<update id="updateZdyPrintLog" parameterType="ZdyPrintLog">
update zdy_print_log
<trim prefix="SET" suffixOverrides=",">
<if test="ticketId != null">ticket_id =
#{ticketId},
</if>
<if test="orderId != null">order_id =
#{orderId},
</if>
<if test="orderItemId != null">order_item_id =
#{orderItemId},
</if>
<if test="orderDetailId != null">order_detail_id =
#{orderDetailId},
</if>
<if test="orderDetailChildId != null">order_detail_child_id =
#{orderDetailChildId},
</if>
<if test="printType != null">print_type =
#{printType},
</if>
<if test="printNum != null">print_num =
#{printNum},
</if>
<if test="adminId != null">admin_id =
#{adminId},
</if>
<if test="adminName != null">admin_name =
#{adminName},
</if>
<if test="userId != null">user_id =
#{userId},
</if>
<if test="userName != null">user_name =
#{userName},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="printStatus != null">print_status =
#{printStatus},
</if>
<if test="failMsg != null">fail_msg =
#{failMsg},
</if>
<if test="ticketName != null">ticket_name =
#{ticketName},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyPrintLogById" parameterType="Long">
delete from zdy_print_log where id = #{id}
</delete>
<delete id="deleteZdyPrintLogByIds" parameterType="String">
delete from zdy_print_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectPrintNum" resultType="Integer">
select ifnull(sum(print_num),0) as printNum from zdy_print_log
where order_detail_id = #{orderDetailId} and print_type = #{printType}
</select>
</mapper>