Stwzhj-Cloud-Plus/stwzhj-modules/wzhj-system/src/main/resources/mapper/system/TDeviceMapper.xml

57 lines
2.5 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="org.dromara.system.mapper.TDeviceMapper">
<resultMap id="deviceStaticsResult" type="org.dromara.system.domain.vo.DeviceStaticsVo">
</resultMap>
<resultMap id="DeviceExportResult" type="org.dromara.system.domain.vo.TDeviceExportVo">
</resultMap>
<resultMap id="DevicetResult" type="org.dromara.system.domain.vo.TDeviceVo">
</resultMap>
<select id="countByDs" resultMap="deviceStaticsResult">
SELECT SUBSTR(zzjgdm,1,4) zzjgdm,count(*) co from t_device GROUP BY SUBSTR(zzjgdm,1,4) HAVING SUBSTR(zzjgdm,1,4) is not null
</select>
<select id="selectDeviceExportList" resultMap="DeviceExportResult">
select u.device_code, u.device_type, u.zzjgdm, u.zzjgmc, u.police_no, u.police_name, u.phone_num, u.car_num, u.valid,
u.remark1, u.remark2, u.card_num, u.create_time, u.update_time
from t_device u
${ew.getCustomSqlSegment}
</select>
<select id="selectPageDevicetList" resultMap="DevicetResult">
select u.id,u.device_code, u.device_type, u.zzjgdm, u.zzjgmc, u.police_no, u.police_name, u.phone_num, u.car_num, u.valid,
u.remark1, u.remark2, u.card_num, u.create_time, u.update_time
from t_device u
${ew.getCustomSqlSegment}
</select>
<update id="updateBatch" parameterType="map">
update t_device set zzjgdm = #{zzjgdm},zzjgmc = #{zzjgmc}
where device_code in
<foreach item="deviceCode" collection="deviceCode" open="(" separator="," close=")">
#{deviceCode}
</foreach>
</update>
<insert id="insertOrUpdateByCodeAndType">
insert into t_device (device_code, device_type, zzjgdm, zzjgmc, police_no, police_name, phone_num, car_num, valid,
remark1, remark2, card_num, create_time, update_time)
values (#{deviceCode},#{deviceType},#{zzjgdm},#{zzjgmc},#{policeNo},#{policeName},#{phoneNum},#{carNum},#{valid},
#{remark1},#{remark2},#{cardNum},#{createTime},#{updateTime})
ON DUPLICATE KEY UPDATE
police_no = values(police_no),police_name = values(police_name),phone_num = values(phone_num),
car_num = values(car_num),valid = '1',remark1 = values(remark1),remark2 = values(remark2),card_num = values(card_num),
update_time = values(update_time)
</insert>
</mapper>