打印机相关

This commit is contained in:
2025-04-01 16:22:52 +08:00
parent dc7c4a13cb
commit 7d8483b6e4
12 changed files with 470 additions and 0 deletions

View File

@ -0,0 +1,80 @@
<?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.ycwl.basic.mapper.PrinterMapper">
<!-- 查询列表 -->
<select id="list" parameterType="com.ycwl.basic.model.pc.printer.entity.PrinterEntity" resultType="com.ycwl.basic.model.pc.printer.entity.PrinterEntity">
SELECT * FROM printer
<where>
<if test="condition != null">
<if test="condition.scenicId != null">
AND scenic_id = #{condition.scenicId}
</if>
<if test="condition.status != null">
AND status = #{condition.status}
</if>
<if test="condition.name != null and condition.name != ''">
AND name LIKE CONCAT('%', #{condition.name}, '%')
</if>
</if>
</where>
</select>
<!-- 获取单条记录 -->
<select id="getById" resultType="com.ycwl.basic.model.pc.printer.entity.PrinterEntity">
SELECT * FROM printer WHERE id = #{id}
</select>
<select id="findByAccessKey" resultType="com.ycwl.basic.model.pc.printer.entity.PrinterEntity">
SELECT * FROM printer WHERE access_key = #{accessKey} LIMIT 1
</select>
<select id="findTaskByPrinterId" resultType="com.ycwl.basic.model.printer.resp.PrintTaskResp">
select * FROM print_task WHERE status = 0 and printer_id = #{printerId} LIMIT 1
</select>
<select id="getTaskById" resultType="com.ycwl.basic.model.pc.printer.entity.PrintTaskEntity">
select * from print_task WHERE id = #{id}
</select>
<!-- 新增 -->
<insert id="add">
INSERT INTO printer (
access_key,
name,
scenic_id,
printers,
use_printer,
status,
create_time,
update_time
) VALUES (
#{accessKey},
#{name},
#{scenicId},
#{printers},
#{usePrinter},
#{status},
NOW(),
NOW()
)
</insert>
<!-- 更新 -->
<update id="update">
UPDATE printer
SET
access_key = #{accessKey},
name = #{name},
scenic_id = #{scenicId},
printers = #{printers},
use_printer = #{usePrinter},
status = #{status},
update_time = NOW()
WHERE id = #{id}
</update>
<update id="updateTaskStatus">
UPDATE print_task SET status = #{status}, update_time = NOW() WHERE id = #{id}
</update>
<!-- 删除 -->
<delete id="deleteById">
DELETE FROM printer WHERE id = #{id}
</delete>
</mapper>