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.
161 lines
8.6 KiB
XML
161 lines
8.6 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.EquCheckItemMapper">
|
|
|
|
<resultMap type="EquCheckItem" id="EquCheckItemResult">
|
|
<result property="itemId" column="item_id" />
|
|
<result property="itemCode" column="item_code" />
|
|
<result property="itemName" column="item_name" />
|
|
<result property="itemMethod" column="item_method" />
|
|
<result property="itemType" column="item_type" />
|
|
<result property="itemTypeName" column="item_type_name" />
|
|
<result property="itemRemark" column="item_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="createTime" column="create_time" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="itemTools" column="item_tools" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEquCheckItemVo">
|
|
select item_id, item_code, item_name, item_method, item_type, item_type_name, item_remark, factory_code, attr1, attr2, attr3, del_flag, create_time, create_by, update_time, update_by ,item_tools from equ_check_item
|
|
</sql>
|
|
|
|
<select id="selectEquCheckItemList" parameterType="EquCheckItem" resultMap="EquCheckItemResult">
|
|
<include refid="selectEquCheckItemVo"/>
|
|
<where>
|
|
<if test="itemCode != null and itemCode != ''"> and item_code like concat('%', #{itemCode}, '%')</if>
|
|
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
|
|
<if test="itemMethod != null and itemMethod != ''"> and item_method like concat('%', #{itemMethod}, '%')</if>
|
|
<if test="itemType != null and itemType != ''"> and item_type = #{itemType}</if>
|
|
<if test="itemTypeName != null and itemTypeName != ''"> and item_type_name like concat('%', #{itemTypeName}, '%')</if>
|
|
<if test="itemRemark != null and itemRemark != ''"> and item_remark = #{itemRemark}</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="itemTools != null and itemTools != ''"> and item_tools like concat('%', #{itemTools}, '%')</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'
|
|
ORDER BY create_time DESC
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectEquCheckItemByItemId" parameterType="String" resultMap="EquCheckItemResult">
|
|
<include refid="selectEquCheckItemVo"/>
|
|
where item_id = #{itemId} and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectEquCheckItemByItemName" parameterType="String" resultMap="EquCheckItemResult">
|
|
<include refid="selectEquCheckItemVo"/>
|
|
where item_name = #{itemName} and del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectSerialNumber" resultType="java.lang.Integer">
|
|
SELECT COUNT(item_id)+1 AS serialNum
|
|
FROM equ_check_item
|
|
WHERE CONVERT(date, GETDATE()) = CONVERT(date,create_time)
|
|
</select>
|
|
|
|
<select id="selectAllEquipmentList" resultType="com.op.device.domain.vo.EquCheckItemVO">
|
|
select equipment_name AS 'equipmentName',equipment_code AS 'equipmentCode' from base_equipment where del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectCheckItemByEquipmentCode" parameterType="String" resultMap="EquCheckItemResult">
|
|
<include refid="selectEquCheckItemVo"/>
|
|
where item_code in ( select item_code from equ_item_equipment where equipment_code = #{equipmentCode} and del_flag = '0' ) and del_flag = '0' and item_type = #{type}
|
|
</select>
|
|
|
|
<select id="checkDelItem" resultType="com.op.device.domain.EquPlanDetail">
|
|
select item_code AS 'itemCode' from equ_plan_detail where del_flag = '0' and item_code = #{itemCode}
|
|
</select>
|
|
|
|
<insert id="insertEquCheckItem" parameterType="EquCheckItem">
|
|
insert into equ_check_item
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="itemId != null">item_id,</if>
|
|
<if test="itemCode != null and itemCode != ''">item_code,</if>
|
|
<if test="itemName != null and itemName != ''">item_name,</if>
|
|
<if test="itemMethod != null and itemMethod != ''">item_method,</if>
|
|
<if test="itemType != null and itemType != ''">item_type,</if>
|
|
<if test="itemTypeName != null and itemTypeName != ''">item_type_name,</if>
|
|
<if test="itemRemark != null and itemRemark != ''">item_remark,</if>
|
|
<if test="factoryCode != null">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="createTime != null">create_time,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="itemTools != null and itemTools != ''">item_tools,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="itemId != null">#{itemId},</if>
|
|
<if test="itemCode != null and itemCode != ''">#{itemCode},</if>
|
|
<if test="itemName != null and itemName != ''">#{itemName},</if>
|
|
<if test="itemMethod != null and itemMethod != ''">#{itemMethod},</if>
|
|
<if test="itemType != null and itemType != ''">#{itemType},</if>
|
|
<if test="itemTypeName != null and itemTypeName != ''">#{itemTypeName},</if>
|
|
<if test="itemRemark != null and itemRemark != ''">#{itemRemark},</if>
|
|
<if test="factoryCode != null">#{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="createTime != null">#{createTime},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="itemTools != null and itemTools != ''">#{itemTools},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEquCheckItem" parameterType="EquCheckItem">
|
|
update equ_check_item
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="itemCode != null and itemCode != ''">item_code = #{itemCode},</if>
|
|
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
|
|
<if test="itemMethod != null and itemMethod != ''">item_method = #{itemMethod},</if>
|
|
<if test="itemType != null and itemType != ''">item_type = #{itemType},</if>
|
|
<if test="itemTypeName != null and itemTypeName != ''">item_type_name = #{itemTypeName},</if>
|
|
<if test="itemRemark != null and itemRemark != ''">item_remark = #{itemRemark},</if>
|
|
<if test="factoryCode != null">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="createTime != null">create_time = #{createTime},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</if>
|
|
</trim>
|
|
where item_id = #{itemId} and del_flag = '0'
|
|
</update>
|
|
|
|
<delete id="deleteEquCheckItemByItemId" parameterType="String">
|
|
update equ_check_item set del_flag = '1' where item_id = #{itemId}
|
|
</delete>
|
|
|
|
<delete id="deleteEquCheckItemByItemIds" parameterType="String">
|
|
update equ_check_item set del_flag = '1' where item_id in
|
|
<foreach item="itemId" collection="array" open="(" separator="," close=")">
|
|
#{itemId}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |