114 lines
5.3 KiB
XML
114 lines
5.3 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.ruoyi.system.mapper.EtFaultMapper">
|
|
|
|
<resultMap type="EtFault" id="EtFaultResult">
|
|
<result property="faultId" column="fault_id" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="deviceMac" column="device_mac" />
|
|
<result property="sn" column="sn" />
|
|
<result property="type" column="type" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="picture" column="picture" />
|
|
<result property="detail" column="detail" />
|
|
<result property="orderId" column="order_id" />
|
|
<result property="orderNo" column="order_no" />
|
|
<result property="status" column="status" />
|
|
<result property="areaId" column="area_id" />
|
|
<result property="address" column="address" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEtFaultVo">
|
|
select fault_id, area_id, user_id, device_mac, sn, type, create_time, picture, detail, order_id, order_no, status, address from et_fault
|
|
</sql>
|
|
|
|
<select id="selectEtFaultList" parameterType="EtFault" resultMap="EtFaultResult">
|
|
select f.fault_id, f.area_id, f.user_id, f.device_mac, f.sn, f.type, f.create_time, f.picture, f.detail, f.order_id, f.order_no,f.status, f.address from et_fault f
|
|
left join et_area_dept ad on ad.area_id = f.area_id
|
|
left join sys_dept d on d.dept_id = ad.dept_id
|
|
where 1 = 1
|
|
<if test="userId != null "> and f.user_id = #{userId}</if>
|
|
<if test="type != null and type != ''"> and f.type = #{type}</if>
|
|
<if test="status != null and status != ''"> and f.status = #{status}</if>
|
|
<!-- 数据范围过滤 -->
|
|
${params.dataScope}
|
|
</select>
|
|
|
|
<select id="selectEtFaultByFaultId" parameterType="Long" resultMap="EtFaultResult">
|
|
<include refid="selectEtFaultVo"/>
|
|
where fault_id = #{faultId}
|
|
</select>
|
|
|
|
<insert id="insertEtFault" parameterType="EtFault">
|
|
insert into et_fault
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="faultId != null">fault_id,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="areaId != null">area_id,</if>
|
|
<if test="deviceMac != null">device_mac,</if>
|
|
<if test="sn != null">sn,</if>
|
|
<if test="type != null">type,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="picture != null">picture,</if>
|
|
<if test="detail != null">detail,</if>
|
|
<if test="orderId != null">order_id,</if>
|
|
<if test="orderNo != null">order_no,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="address != null">address,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="faultId != null">#{faultId},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="areaId != null">#{areaId},</if>
|
|
<if test="deviceMac != null">#{deviceMac},</if>
|
|
<if test="sn != null">#{sn},</if>
|
|
<if test="type != null">#{type},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="picture != null">#{picture},</if>
|
|
<if test="detail != null">#{detail},</if>
|
|
<if test="orderId != null">#{orderId},</if>
|
|
<if test="orderNo != null">#{orderNo},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="address != null">#{address},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEtFault" parameterType="EtFault">
|
|
update et_fault
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="areaId != null">area_id = #{areaId},</if>
|
|
<if test="deviceMac != null">device_mac = #{deviceMac},</if>
|
|
<if test="sn != null">sn = #{sn},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="picture != null">picture = #{picture},</if>
|
|
<if test="detail != null">detail = #{detail},</if>
|
|
<if test="orderId != null">order_id = #{orderId},</if>
|
|
<if test="orderNo != null">order_no = #{orderNo},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="address != null">address = #{address},</if>
|
|
</trim>
|
|
where fault_id = #{faultId}
|
|
</update>
|
|
|
|
<delete id="deleteEtFaultByFaultId" parameterType="Long">
|
|
delete from et_fault where fault_id = #{faultId}
|
|
</delete>
|
|
|
|
<delete id="deleteEtFaultByFaultIds" parameterType="String">
|
|
delete from et_fault where fault_id in
|
|
<foreach item="faultId" collection="array" open="(" separator="," close=")">
|
|
#{faultId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="getAuditFaultNum" parameterType="long" resultType="java.lang.Integer">
|
|
select COALESCE(count(1), 0) from et_fault f
|
|
where f.status = '1'
|
|
<if test="areaId != null and areaId != ''"> and f.area_id = #{areaId}</if>
|
|
</select>
|
|
</mapper>
|