You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
6.5 KiB
XML
128 lines
6.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="com.op.device.mapper.EquFaultReasonMapper">
|
|
|
|
<resultMap type="EquFaultReason" id="EquFaultReasonResult">
|
|
<result property="faultId" column="fault_id" />
|
|
<result property="faultCode" column="fault_code" />
|
|
<result property="faultType" column="fault_type" />
|
|
<result property="faultSubclass" column="fault_subclass" />
|
|
<result property="faultRemark" column="fault_remark" />
|
|
<result property="factoryCode" column="factory_code" />
|
|
<result property="attr1" column="attr1" />
|
|
<result property="attr2" column="attr2" />
|
|
<result property="attr3" column="attr3" />
|
|
<result property="delFlag" column="del_flag" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEquFaultReasonVo">
|
|
select fault_id, fault_code, fault_type, fault_subclass, fault_remark, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_fault_reason
|
|
</sql>
|
|
|
|
<select id="selectEquFaultReasonList" parameterType="EquFaultReason" resultMap="EquFaultReasonResult">
|
|
<include refid="selectEquFaultReasonVo"/>
|
|
<where>
|
|
<if test="faultCode != null and faultCode != ''"> and fault_code like concat('%', #{faultCode}, '%')</if>
|
|
<if test="faultType != null and faultType != ''"> and fault_type like concat('%', #{faultType}, '%')</if>
|
|
<if test="faultSubclass != null and faultSubclass != ''"> and fault_subclass like concat('%', #{faultSubclass}, '%')</if>
|
|
<if test="faultRemark != null and faultRemark != ''"> and fault_remark = #{faultRemark}</if>
|
|
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
|
|
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
|
|
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
|
|
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
|
<if test="createTimeStart != null "> and CONVERT(date,create_time) >= #{createTimeStart}</if>
|
|
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,create_time)</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="updateTimeStart != null "> and CONVERT(date,update_time) >= #{updateTimeStart}</if>
|
|
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,update_time)</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
and del_flag = '0'
|
|
</where>
|
|
ORDER BY CAST(RIGHT(fault_code, 4) AS INTEGER)
|
|
</select>
|
|
|
|
<select id="selectEquFaultReasonByFaultId" parameterType="String" resultMap="EquFaultReasonResult">
|
|
<include refid="selectEquFaultReasonVo"/>
|
|
where fault_id = #{faultId}
|
|
</select>
|
|
|
|
<insert id="insertEquFaultReason" parameterType="EquFaultReason">
|
|
insert into equ_fault_reason
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="faultId != null">fault_id,</if>
|
|
<if test="faultCode != null and faultCode != ''">fault_code,</if>
|
|
<if test="faultType != null and faultType != ''">fault_type,</if>
|
|
<if test="faultSubclass != null">fault_subclass,</if>
|
|
<if test="faultRemark != null">fault_remark,</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
<if test="attr1 != null">attr1,</if>
|
|
<if test="attr2 != null">attr2,</if>
|
|
<if test="attr3 != null">attr3,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="faultId != null">#{faultId},</if>
|
|
<if test="faultCode != null and faultCode != ''">#{faultCode},</if>
|
|
<if test="faultType != null and faultType != ''">#{faultType},</if>
|
|
<if test="faultSubclass != null">#{faultSubclass},</if>
|
|
<if test="faultRemark != null">#{faultRemark},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEquFaultReason" parameterType="EquFaultReason">
|
|
update equ_fault_reason
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="faultCode != null and faultCode != ''">fault_code = #{faultCode},</if>
|
|
<if test="faultType != null and faultType != ''">fault_type = #{faultType},</if>
|
|
<if test="faultSubclass != null">fault_subclass = #{faultSubclass},</if>
|
|
<if test="faultRemark != null">fault_remark = #{faultRemark},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where fault_id = #{faultId}
|
|
</update>
|
|
|
|
<delete id="deleteEquFaultReasonByFaultId" parameterType="String">
|
|
delete from equ_fault_reason where fault_id = #{faultId}
|
|
</delete>
|
|
|
|
<delete id="deleteEquFaultReasonByFaultIds" parameterType="String">
|
|
delete from equ_fault_reason where fault_id in
|
|
<foreach item="faultId" collection="array" open="(" separator="," close=")">
|
|
#{faultId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectSerialNumber" resultType="java.lang.Integer">
|
|
SELECT COUNT(fault_id)+1 AS serialNum
|
|
FROM equ_fault_reason
|
|
WHERE del_flag = '0'
|
|
</select>
|
|
</mapper> |