You've already forked FrameTour-BE
50 lines
1.9 KiB
XML
50 lines
1.9 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.pc.DeviceMapper">
|
|
<insert id="add">
|
|
insert into device(id, scenic_id, name, no) values (#{id}, #{scenicId}, #{name}, #{no})
|
|
</insert>
|
|
<update id="update">
|
|
update device set scenic_id = #{scenicId}, name = #{name}, no = #{no} where id = #{id}
|
|
</update>
|
|
<update id="updateStatus">
|
|
update device
|
|
set status = (CASE
|
|
status
|
|
WHEN 1 THEN
|
|
0
|
|
WHEN 0 THEN
|
|
1
|
|
ELSE null
|
|
END)
|
|
where id = #{id}
|
|
</update>
|
|
<delete id="deleteById">
|
|
delete from device where id = #{id}
|
|
</delete>
|
|
<select id="list" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
|
select d.id, scenic_id, d.name, no, d.status, create_at, d.update_at, s.name scenic_name
|
|
from device d
|
|
left join scenic s on d.scenic_id = s.id
|
|
<where>
|
|
<if test="name!= null and name!= ''">
|
|
and d.`name` like concat('%', #{name}, '%')
|
|
</if>
|
|
<if test="no!= null and no!= ''">
|
|
and `no` like concat('%', #{no}, '%')
|
|
</if>
|
|
<if test="status!= null">
|
|
and d.`status` = #{status}
|
|
</if>
|
|
<if test="scenicId!= null and scenicId!= ''">
|
|
and scenic_id = #{scenicId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="getById" resultType="com.ycwl.basic.model.pc.device.resp.DeviceRespVO">
|
|
select d.id, scenic_id, d.name, no, d.status, create_at, d.update_at, s.name scenic_name
|
|
from device d
|
|
left join scenic s on d.scenic_id = s.id
|
|
where d.id = #{id}
|
|
</select>
|
|
</mapper> |