123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <?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.warewms.agv.ndc.mapper.AmsHexdefineHeaderMapper">
-
- <resultMap type="AmsHexdefineHeader" id="AmsHexdefineHeaderResult">
- <result property="id" column="id" />
- <result property="taskName" column="task_name" />
- <result property="businessType" column="business_type" />
- <result property="createDate" column="create_date" />
- </resultMap>
- <resultMap id="AmsHexdefineHeaderAmsHexdefineDetailResult" type="AmsHexdefineHeader" extends="AmsHexdefineHeaderResult">
- <collection property="amsHexdefineDetailList" notNullColumn="sub_id" javaType="java.util.List" resultMap="AmsHexdefineDetailResult" />
- </resultMap>
- <resultMap type="AmsHexdefineDetail" id="AmsHexdefineDetailResult">
- <result property="id" column="sub_id" />
- <result property="businessType" column="sub_business_type" />
- <result property="colName" column="sub_col_name" />
- <result property="colType" column="sub_col_type" />
- <result property="bindTable" column="sub_bind_table" />
- <result property="colVal" column="sub_col_val" />
- <result property="valType" column="sub_val_type" />
- <result property="sortIndex" column="sub_sort_index" />
- </resultMap>
- <sql id="selectAmsHexdefineHeaderVo">
- select id, task_name, business_type, create_date from ams_hexdefine_header
- </sql>
- <select id="selectAmsHexdefineHeaderList" parameterType="AmsHexdefineHeader" resultMap="AmsHexdefineHeaderResult">
- <include refid="selectAmsHexdefineHeaderVo"/>
- <where>
- <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
- <if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
- <if test="createDate != null "> and create_date = #{createDate}</if>
- </where>
- </select>
-
- <select id="selectAmsHexdefineHeaderById" parameterType="Long" resultMap="AmsHexdefineHeaderAmsHexdefineDetailResult">
- select a.id, a.task_name, a.business_type, a.create_date,
- b.id as sub_id, b.business_type as sub_business_type, b.col_name as sub_col_name, b.col_type as sub_col_type, b.bind_table as sub_bind_table, b.col_val as sub_col_val, b.val_type as sub_val_type, b.sort_index as sub_sort_index
- from ams_hexdefine_header a
- left join ams_hexdefine_detail b on b.business_type = a.id
- where a.id = #{id}
- </select>
-
- <insert id="insertAmsHexdefineHeader" parameterType="AmsHexdefineHeader" useGeneratedKeys="true" keyProperty="id">
- insert into ams_hexdefine_header
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="taskName != null">task_name,</if>
- <if test="businessType != null">business_type,</if>
- <if test="createDate != null">create_date,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="taskName != null">#{taskName},</if>
- <if test="businessType != null">#{businessType},</if>
- <if test="createDate != null">#{createDate},</if>
- </trim>
- </insert>
- <update id="updateAmsHexdefineHeader" parameterType="AmsHexdefineHeader">
- update ams_hexdefine_header
- <trim prefix="SET" suffixOverrides=",">
- <if test="taskName != null">task_name = #{taskName},</if>
- <if test="businessType != null">business_type = #{businessType},</if>
- <if test="createDate != null">create_date = #{createDate},</if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteAmsHexdefineHeaderById" parameterType="Long">
- delete from ams_hexdefine_header where id = #{id}
- </delete>
- <delete id="deleteAmsHexdefineHeaderByIds" parameterType="String">
- delete from ams_hexdefine_header where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
-
- <delete id="deleteAmsHexdefineDetailByBusinessTypes" parameterType="String">
- delete from ams_hexdefine_detail where business_type in
- <foreach item="businessType" collection="array" open="(" separator="," close=")">
- #{businessType}
- </foreach>
- </delete>
- <delete id="deleteAmsHexdefineDetailByBusinessType" parameterType="Long">
- delete from ams_hexdefine_detail where business_type = #{businessType}
- </delete>
- <insert id="batchAmsHexdefineDetail">
- insert into ams_hexdefine_detail( id, business_type, col_name, col_type, bind_table, col_val, val_type, sort_index) values
- <foreach item="item" index="index" collection="list" separator=",">
- ( #{item.id}, #{item.businessType}, #{item.colName}, #{item.colType}, #{item.bindTable}, #{item.colVal}, #{item.valType}, #{item.sortIndex})
- </foreach>
- </insert>
- </mapper>
|