|
|
|
<?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.EquOrderDetailMapper">
|
|
|
|
|
|
|
|
<resultMap type="EquOrderDetail" id="EquOrderDetailResult">
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="code" column="code"/>
|
|
|
|
<result property="orderCode" column="order_code"/>
|
|
|
|
<result property="parentCode" column="parent_code"/>
|
|
|
|
<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="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"/>
|
|
|
|
<result property="itemTools" column="item_tools"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<sql id="selectEquOrderDetailVo">
|
|
|
|
select id, code, order_code, parent_code, item_code, item_name, item_method,
|
|
|
|
item_type, item_type_name, factory_code, attr1, attr2, attr3, del_flag,
|
|
|
|
create_by, create_time, update_by, update_time,item_tools
|
|
|
|
from equ_order_detail
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<select id="selectEquOrderDetailList" parameterType="EquOrderDetail" resultMap="EquOrderDetailResult">
|
|
|
|
<include refid="selectEquOrderDetailVo"/>
|
|
|
|
<where>
|
|
|
|
<if test="code != null and code != ''">and code = #{code}</if>
|
|
|
|
<if test="orderCode != null and orderCode != ''">and order_code = #{orderCode}</if>
|
|
|
|
<if test="parentCode != null and parentCode != ''">and parent_code = #{parentCode}</if>
|
|
|
|
<if test="itemCode != null and itemCode != ''">and item_code = #{itemCode}</if>
|
|
|
|
<if test="itemName != null and itemName != ''">and item_name like concat('%', #{itemName}, '%')</if>
|
|
|
|
<if test="itemMethod != null and itemMethod != ''">and item_method = #{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="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="itemTools != null and itemTools != ''">and item_tools = #{itemTools}</if>
|
|
|
|
and del_flag = '0'
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquOrderDetailById" parameterType="String" resultMap="EquOrderDetailResult">
|
|
|
|
<include refid="selectEquOrderDetailVo"/>
|
|
|
|
where id = #{id} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquOrderDetailByParentCode" parameterType="String" resultMap="EquOrderDetailResult">
|
|
|
|
<include refid="selectEquOrderDetailVo"/>
|
|
|
|
where parent_code = #{parentCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selectEquOrderDetailByOrderCode" parameterType="String" resultMap="EquOrderDetailResult">
|
|
|
|
<include refid="selectEquOrderDetailVo"/>
|
|
|
|
where order_code = #{orderCode} and del_flag = '0'
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertEquOrderDetail" parameterType="EquOrderDetail">
|
|
|
|
insert into equ_order_detail
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">id,</if>
|
|
|
|
<if test="code != null">code,</if>
|
|
|
|
<if test="orderCode != null">order_code,</if>
|
|
|
|
<if test="parentCode != null">parent_code,</if>
|
|
|
|
<if test="itemCode != null">item_code,</if>
|
|
|
|
<if test="itemName != null">item_name,</if>
|
|
|
|
<if test="itemMethod != null">item_method,</if>
|
|
|
|
<if test="itemType != null">item_type,</if>
|
|
|
|
<if test="itemTypeName != null">item_type_name,</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>
|
|
|
|
<if test="itemTools != null">item_tools,</if>
|
|
|
|
</trim>
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
<if test="id != null">#{id},</if>
|
|
|
|
<if test="code != null">#{code},</if>
|
|
|
|
<if test="orderCode != null">#{orderCode},</if>
|
|
|
|
<if test="parentCode != null">#{parentCode},</if>
|
|
|
|
<if test="itemCode != null">#{itemCode},</if>
|
|
|
|
<if test="itemName != null">#{itemName},</if>
|
|
|
|
<if test="itemMethod != null">#{itemMethod},</if>
|
|
|
|
<if test="itemType != null">#{itemType},</if>
|
|
|
|
<if test="itemTypeName != null">#{itemTypeName},</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>
|
|
|
|
<if test="itemTools != null">#{itemTools},</if>
|
|
|
|
</trim>
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insertEquOrderDetails">
|
|
|
|
insert into equ_order_detail
|
|
|
|
(
|
|
|
|
id, order_code,
|
|
|
|
item_code, item_name, item_method,
|
|
|
|
item_type, item_type_name, factory_code, del_flag,
|
|
|
|
create_by, create_time
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
<foreach collection="list" index="index" item="item" separator=",">
|
|
|
|
(
|
|
|
|
#{item.id},#{item.parentCode},
|
|
|
|
#{item.itemCode},#{item.itemName},#{item.itemMethod},
|
|
|
|
#{item.itemType},#{item.itemTypeName},#{item.factoryCode},#{item.delFlag},
|
|
|
|
#{item.createBy},#{item.createTime}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateEquOrderDetail" parameterType="EquOrderDetail">
|
|
|
|
update equ_order_detail
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
<if test="code != null">code = #{code},</if>
|
|
|
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
|
|
|
<if test="parentCode != null">parent_code = #{parentCode},</if>
|
|
|
|
<if test="itemCode != null">item_code = #{itemCode},</if>
|
|
|
|
<if test="itemName != null">item_name = #{itemName},</if>
|
|
|
|
<if test="itemMethod != null">item_method = #{itemMethod},</if>
|
|
|
|
<if test="itemType != null">item_type = #{itemType},</if>
|
|
|
|
<if test="itemTypeName != null">item_type_name = #{itemTypeName},</if>
|
|
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
|
|
<if test="itemTools != null and itemTools != ''">item_tools = #{itemTools},</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 id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteEquOrderDetailById" parameterType="String">
|
|
|
|
delete from equ_order_detail where id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteEquOrderDetailByIds" parameterType="String">
|
|
|
|
delete from equ_order_detail where id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="delEquOrderDetailByorderIds" parameterType="String">
|
|
|
|
update equ_order_detail set del_flag = '1' where del_flag = '0' and order_code in ( select order_code from
|
|
|
|
equ_order where del_flag = '0' and order_id in
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
#{id}
|
|
|
|
</foreach>
|
|
|
|
)
|
|
|
|
</delete>
|
|
|
|
</mapper>
|