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.

143 lines
7.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.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="factoryCode" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="delFlag" column="del_flag" />
<result property="createdTime" column="created_time" />
<result property="createdBy" column="created_by" />
<result property="updatedTime" column="updated_time" />
<result property="updatedBy" column="updated_by" />
</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, created_time, created_by, updated_time, updated_by 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="createTimeStart != null "> and CONVERT(date,created_time) >= #{createTimeStart}</if>
<if test="createTimeEnd != null "> and #{createTimeEnd} >= CONVERT(date,created_time)</if>
<if test="createdBy != null and createdBy != ''"> and created_by like concat('%', #{createdBy}, '%')</if>
<if test="updateTimeStart != null "> and CONVERT(date,updated_time) >= #{updateTimeStart}</if>
<if test="updateTimeEnd != null "> and #{updateTimeEnd} >= CONVERT(date,updated_time)</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by like concat('%', #{updatedBy}, '%')</if>
and del_flag = '0'
ORDER BY created_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,created_time) and del_flag = '0'
</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="createdTime != null">created_time,</if>
<if test="createdBy != null and createdBy != ''">created_by,</if>
<if test="updatedTime != null">updated_time,</if>
<if test="updatedBy != null and updatedBy != ''">updated_by,</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="createdTime != null">#{createdTime},</if>
<if test="createdBy != null and createdBy != ''">#{createdBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
<if test="updatedBy != null and updatedBy != ''">#{updatedBy},</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="createdTime != null">created_time = #{createdTime},</if>
<if test="createdBy != null and createdBy != ''">created_by = #{createdBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="updatedBy != null and updatedBy != ''">updated_by = #{updatedBy},</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>