AmsHexdefineHeaderMapper.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.warewms.agv.ndc.mapper.AmsHexdefineHeaderMapper">
  6. <resultMap type="AmsHexdefineHeader" id="AmsHexdefineHeaderResult">
  7. <result property="id" column="id" />
  8. <result property="taskName" column="task_name" />
  9. <result property="businessType" column="business_type" />
  10. <result property="createDate" column="create_date" />
  11. </resultMap>
  12. <resultMap id="AmsHexdefineHeaderAmsHexdefineDetailResult" type="AmsHexdefineHeader" extends="AmsHexdefineHeaderResult">
  13. <collection property="amsHexdefineDetailList" notNullColumn="sub_id" javaType="java.util.List" resultMap="AmsHexdefineDetailResult" />
  14. </resultMap>
  15. <resultMap type="AmsHexdefineDetail" id="AmsHexdefineDetailResult">
  16. <result property="id" column="sub_id" />
  17. <result property="businessType" column="sub_business_type" />
  18. <result property="colName" column="sub_col_name" />
  19. <result property="colType" column="sub_col_type" />
  20. <result property="bindTable" column="sub_bind_table" />
  21. <result property="colVal" column="sub_col_val" />
  22. <result property="valType" column="sub_val_type" />
  23. <result property="sortIndex" column="sub_sort_index" />
  24. </resultMap>
  25. <sql id="selectAmsHexdefineHeaderVo">
  26. select id, task_name, business_type, create_date from ams_hexdefine_header
  27. </sql>
  28. <select id="selectAmsHexdefineHeaderList" parameterType="AmsHexdefineHeader" resultMap="AmsHexdefineHeaderResult">
  29. <include refid="selectAmsHexdefineHeaderVo"/>
  30. <where>
  31. <if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
  32. <if test="businessType != null and businessType != ''"> and business_type = #{businessType}</if>
  33. <if test="createDate != null "> and create_date = #{createDate}</if>
  34. </where>
  35. </select>
  36. <select id="selectAmsHexdefineHeaderById" parameterType="Long" resultMap="AmsHexdefineHeaderAmsHexdefineDetailResult">
  37. select a.id, a.task_name, a.business_type, a.create_date,
  38. 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
  39. from ams_hexdefine_header a
  40. left join ams_hexdefine_detail b on b.business_type = a.id
  41. where a.id = #{id}
  42. </select>
  43. <insert id="insertAmsHexdefineHeader" parameterType="AmsHexdefineHeader" useGeneratedKeys="true" keyProperty="id">
  44. insert into ams_hexdefine_header
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="taskName != null">task_name,</if>
  47. <if test="businessType != null">business_type,</if>
  48. <if test="createDate != null">create_date,</if>
  49. </trim>
  50. <trim prefix="values (" suffix=")" suffixOverrides=",">
  51. <if test="taskName != null">#{taskName},</if>
  52. <if test="businessType != null">#{businessType},</if>
  53. <if test="createDate != null">#{createDate},</if>
  54. </trim>
  55. </insert>
  56. <update id="updateAmsHexdefineHeader" parameterType="AmsHexdefineHeader">
  57. update ams_hexdefine_header
  58. <trim prefix="SET" suffixOverrides=",">
  59. <if test="taskName != null">task_name = #{taskName},</if>
  60. <if test="businessType != null">business_type = #{businessType},</if>
  61. <if test="createDate != null">create_date = #{createDate},</if>
  62. </trim>
  63. where id = #{id}
  64. </update>
  65. <delete id="deleteAmsHexdefineHeaderById" parameterType="Long">
  66. delete from ams_hexdefine_header where id = #{id}
  67. </delete>
  68. <delete id="deleteAmsHexdefineHeaderByIds" parameterType="String">
  69. delete from ams_hexdefine_header where id in
  70. <foreach item="id" collection="array" open="(" separator="," close=")">
  71. #{id}
  72. </foreach>
  73. </delete>
  74. <delete id="deleteAmsHexdefineDetailByBusinessTypes" parameterType="String">
  75. delete from ams_hexdefine_detail where business_type in
  76. <foreach item="businessType" collection="array" open="(" separator="," close=")">
  77. #{businessType}
  78. </foreach>
  79. </delete>
  80. <delete id="deleteAmsHexdefineDetailByBusinessType" parameterType="Long">
  81. delete from ams_hexdefine_detail where business_type = #{businessType}
  82. </delete>
  83. <insert id="batchAmsHexdefineDetail">
  84. insert into ams_hexdefine_detail( id, business_type, col_name, col_type, bind_table, col_val, val_type, sort_index) values
  85. <foreach item="item" index="index" collection="list" separator=",">
  86. ( #{item.id}, #{item.businessType}, #{item.colName}, #{item.colType}, #{item.bindTable}, #{item.colVal}, #{item.valType}, #{item.sortIndex})
  87. </foreach>
  88. </insert>
  89. </mapper>