You've already forked FrameTour-BE
129 lines
4.7 KiB
XML
129 lines
4.7 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.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>
|
|
<select id="listByScenicId" resultType="com.ycwl.basic.model.pc.printer.resp.PrinterResp">
|
|
SELECT p.*, s.name as scenic_name
|
|
FROM printer p
|
|
LEFT JOIN scenic s on s.id = p.scenic_id
|
|
WHERE p.scenic_id = #{scenicId} and p.status = 1
|
|
</select>
|
|
<select id="listRelation" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
|
SELECT p.id, p.scenic_id as scenicId, s.name as scenicName, p.member_id as memberId,
|
|
p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
|
p.status, p.create_time as createTime
|
|
FROM member_print p
|
|
LEFT JOIN scenic s ON s.id = p.scenic_id
|
|
WHERE p.member_id = #{memberId} AND p.scenic_id = #{scenicId}
|
|
</select>
|
|
<select id="getUserPhoto" resultType="com.ycwl.basic.model.pc.printer.resp.MemberPrintResp">
|
|
SELECT p.id, p.scenic_id, s.name as scenicName, p.member_id as memberId,
|
|
p.member_id, p.orig_url as origUrl, p.crop_url as cropUrl, p.order_id as orderId, p.quantity,
|
|
p.status, p.create_time as createTime
|
|
FROM member_print p
|
|
LEFT JOIN scenic s ON s.id = p.scenic_id
|
|
WHERE p.id = #{id} AND p.member_id = #{memberId} AND p.scenic_id = #{scenicId}
|
|
</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>
|
|
<insert id="addUserPhoto">
|
|
INSERT INTO member_print (
|
|
member_id,
|
|
scenic_id,
|
|
orig_url,
|
|
crop_url,
|
|
quantity,
|
|
status,
|
|
create_time,
|
|
update_time
|
|
) VALUES (
|
|
#{memberId},
|
|
#{scenicId},
|
|
#{url},
|
|
#{url},
|
|
1,
|
|
0,
|
|
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>
|
|
<update id="setPhotoCropped">
|
|
UPDATE member_print SET crop_url = #{url}, update_time = NOW() WHERE id = #{id}
|
|
</update>
|
|
|
|
<!-- 删除 -->
|
|
<delete id="deleteById">
|
|
DELETE FROM printer WHERE id = #{id}
|
|
</delete>
|
|
<delete id="deleteUserPhoto">
|
|
DELETE FROM member_print WHERE member_id = #{memberId} AND scenic_id = #{scenicId} AND id = #{relationId} LIMIT 1;
|
|
</delete>
|
|
</mapper> |