You've already forked FrameTour-BE
添加“device”相关CRUD代码
This commit is contained in:
50
src/main/resources/mapper/pc/DeviceMapper.xml
Normal file
50
src/main/resources/mapper/pc/DeviceMapper.xml
Normal file
@ -0,0 +1,50 @@
|
||||
<?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>
|
Reference in New Issue
Block a user