PrintLayoutMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dk.mdm.mapper.mst.PrintLayoutMapper">
  4. <!-- 通用设置 -->
  5. <!-- 通用查询列 -->
  6. <sql id="Base_Column_List">
  7. layout_id, layout_name, layout_data, doc_name, display_no, flg_valid, remarks, cp_id, op_create_time, op_create_user_id, op_update_time, op_update_user_id, op_app_code, op_timestamp, op_db_user
  8. </sql>
  9. <!-- 通用查询映射结果 -->
  10. <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.mst.PrintLayout">
  11. <id column="layout_id" property="layoutId"/>
  12. <result column="layout_name" property="layoutName"/>
  13. <result column="layout_data" property="layoutData" typeHandler="JsonTypeHandler"/>
  14. <result column="doc_name" property="docName"/>
  15. <result column="display_no" property="displayNo"/>
  16. <result column="flg_valid" property="flgValid"/>
  17. <result column="remarks" property="remarks"/>
  18. <result column="cp_id" property="cpId"/>
  19. <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
  20. <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
  21. <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
  22. <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
  23. <result column="op_app_code" property="opAppCode"/>
  24. <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
  25. <result column="op_db_user" property="opDbUser"/>
  26. </resultMap>
  27. <!-- 通用条件列 -->
  28. <sql id="Condition">
  29. <where>
  30. <if test="layoutName != null and layoutName != ''">
  31. AND layout_name = #{layoutName}
  32. </if>
  33. <if test="layoutData != null and layoutData != ''">
  34. AND layout_data = #{layoutData}
  35. </if>
  36. <if test="docName != null and docName != ''">
  37. AND doc_name = #{docName}
  38. </if>
  39. <if test="displayNo != null">
  40. AND display_no = #{displayNo}
  41. </if>
  42. <if test="flgValid != null">
  43. AND flg_valid = #{flgValid}
  44. </if>
  45. <if test="remarks != null and remarks != ''">
  46. AND remarks = #{remarks}
  47. </if>
  48. <if test="cpId != null">
  49. AND cp_id = #{cpId}
  50. </if>
  51. <if test="flgValidList != null and flgValidList.size()>0">
  52. AND flg_valid = any(#{flgValidList, typeHandler=BooleanListTypeHandler})
  53. </if>
  54. </where>
  55. </sql>
  56. <sql id="idsForeach">
  57. <!-- 根据主键layoutId批量操作 -->
  58. WHERE layout_id in
  59. <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
  60. #{item}
  61. </foreach>
  62. </sql>
  63. <!-- 查询表t_mst_print_layout,(条件查询+分页)列表 -->
  64. <select id="selectByCond" resultMap="BaseResultMap">
  65. SELECT
  66. <include refid="Base_Column_List"/>
  67. FROM dkic_b.t_mst_print_layout
  68. <include refid="Condition"/>
  69. order by display_no
  70. <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
  71. limit #{end} offset #{start}
  72. </if>
  73. </select>
  74. <!-- 查询表t_mst_print_layout,(条件查询)个数 -->
  75. <select id="countByCond" resultType="Long">
  76. SELECT
  77. count(1)
  78. FROM dkic_b.t_mst_print_layout
  79. <include refid="Condition"/>
  80. </select>
  81. <!-- 根据主键查询表t_mst_print_layout的一行数据 -->
  82. <select id="selectById" resultMap="BaseResultMap">
  83. SELECT
  84. <include refid="Base_Column_List"/>
  85. FROM dkic_b.t_mst_print_layout
  86. WHERE layout_id = #{id}::uuid
  87. </select>
  88. <!-- 根据主键锁定表t_mst_print_layout的一行数据 -->
  89. <select id="selectByIdForUpdate" resultMap="BaseResultMap">
  90. SELECT
  91. <include refid="Base_Column_List"/>
  92. FROM dkic_b.t_mst_print_layout
  93. WHERE layout_id = #{id}
  94. for update
  95. </select>
  96. <!-- 根据主键锁定表t_mst_print_layout的多行数据 -->
  97. <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
  98. SELECT
  99. <include refid="Base_Column_List"/>
  100. FROM dkic_b.t_mst_print_layout
  101. <include refid="idsForeach"/>
  102. for update
  103. </select>
  104. <!--票据名称是否重复-->
  105. <select id="selectByName" resultType="Long">
  106. select count(1)
  107. from dkic_b.t_mst_print_layout
  108. where #{layoutName} = layout_name
  109. and cp_id = #{cpId}
  110. <if test="layoutId != null">
  111. and layout_id != #{layoutId} ::uuid
  112. </if>
  113. </select>
  114. <!--获取打印数据-->
  115. <select id="getPrintData" resultType="java.util.Map">
  116. SELECT *
  117. FROM
  118. dkic_b.f_get_print_data(#{dataId} ::uuid, #{objectCode}, #{i18n})
  119. </select>
  120. <insert id="insertBatch">
  121. insert into dkic_b.t_mst_print_layout
  122. (
  123. <trim suffixOverrides=",">
  124. layout_name,
  125. layout_data,
  126. doc_name,
  127. display_no,
  128. remarks,
  129. cp_id,
  130. op_app_code,
  131. </trim>
  132. )
  133. values
  134. <foreach collection="list" index="index" item="item" separator=",">
  135. (
  136. <trim suffixOverrides=",">
  137. #{item.layoutName},
  138. #{item.layoutData},
  139. #{item.docName},
  140. #{item.displayNo},
  141. #{item.remarks},
  142. #{item.cpId},
  143. #{item.opAppCode},
  144. </trim>
  145. )
  146. </foreach>
  147. </insert>
  148. </mapper>