MaterielMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.zkqy.business.mapper.MaterielMapper">
  6. <resultMap type="com.zkqy.business.domain.Materiel" id="MaterielResult">
  7. <result property="id" column="id" />
  8. <result property="materielCode" column="materiel_code" />
  9. <result property="materielName" column="materiel_name" />
  10. <result property="materielAsname" column="materiel_asname" />
  11. <result property="subordinateDepartmen" column="subordinate_departmen" />
  12. <result property="materielSpecies" column="materiel_species" />
  13. <result property="materielUse" column="materiel_use" />
  14. <result property="units" column="units" />
  15. <result property="specificationModel" column="specification_model" />
  16. <result property="status" column="status" />
  17. <result property="dataApprovalStatus" column="data_approval_status" />
  18. <result property="remark" column="remark" />
  19. <result property="createById" column="create_by_id" />
  20. <result property="createBy" column="create_by" />
  21. <result property="createTime" column="create_time" />
  22. <result property="updateById" column="update_by_id" />
  23. <result property="updateBy" column="update_by" />
  24. <result property="updateTime" column="update_time" />
  25. <result property="delFlag" column="del_flag" />
  26. <result property="taskProcessKey" column="task_process_key" />
  27. <result property="taskNodeKey" column="task_node_key" />
  28. <result property="materieEncoding" column="materie_encoding" />
  29. <result property="materieColorNumber" column="materie_color_number" />
  30. </resultMap>
  31. <sql id="selectMaterielVo">
  32. select id, materiel_code, materiel_name, materiel_asname, subordinate_departmen, materiel_species, materiel_use, units, specification_model, status, data_approval_status, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key,
  33. task_node_key,materie_encoding,materie_color_number from {DBNAME}.materiel
  34. </sql>
  35. <select id="selectMaterielList" parameterType="com.zkqy.business.domain.Materiel" resultMap="MaterielResult">
  36. <include refid="selectMaterielVo"/>
  37. where del_flag = '0'
  38. <if test="materielCode != null and materielCode != ''"> and materiel_code = #{materielCode}</if>
  39. <if test="materielName != null and materielName != ''"> and materiel_name like concat('%', #{materielName}, '%')</if>
  40. <if test="materielAsname != null and materielAsname != ''"> and materiel_asname like concat('%', #{materielAsname}, '%')</if>
  41. <if test="subordinateDepartmen != null "> and subordinate_departmen = #{subordinateDepartmen}</if>
  42. <if test="materielSpecies != null and materielSpecies != ''"> and materiel_species = #{materielSpecies}</if>
  43. <if test="materielUse != null and materielUse != ''"> and materiel_use = #{materielUse}</if>
  44. <if test="units != null and units != ''"> and units = #{units}</if>
  45. <if test="specificationModel != null and specificationModel != ''"> and specification_model = #{specificationModel}</if>
  46. <if test="status != null and status != ''"> and status = #{status}</if>
  47. <if test="dataApprovalStatus != null and dataApprovalStatus != ''"> and data_approval_status = #{dataApprovalStatus}</if>
  48. <if test="createById != null "> and create_by_id = #{createById}</if>
  49. <if test="updateById != null "> and update_by_id = #{updateById}</if>
  50. <if test="taskProcessKey != null and taskProcessKey != ''"> and task_process_key = #{taskProcessKey}</if>
  51. <if test="taskNodeKey != null and taskNodeKey != ''"> and task_node_key = #{taskNodeKey}</if>
  52. <if test="materieEncoding != null and materieEncoding != ''"> and materie_encoding = #{materieEncoding}</if>
  53. <if test="materieColorNumber != null and materieColorNumber != ''"> and materie_color_number = #{materieColorNumber}</if>
  54. </select>
  55. <select id="selectMaterielById" parameterType="Long" resultMap="MaterielResult">
  56. <include refid="selectMaterielVo"/>
  57. where id = #{id}
  58. </select>
  59. <select id="selectMaterielByMaterielCode" resultType="com.zkqy.business.domain.Materiel">
  60. <include refid="selectMaterielVo"/>
  61. where materiel_code = #{materielCode}
  62. </select>
  63. <insert id="insertMateriel" parameterType="com.zkqy.business.domain.Materiel" useGeneratedKeys="true" keyProperty="id">
  64. insert into {DBNAME}.materiel
  65. <trim prefix="(" suffix=")" suffixOverrides=",">
  66. <if test="materielCode != null">materiel_code,</if>
  67. <if test="materielName != null">materiel_name,</if>
  68. <if test="materielAsname != null">materiel_asname,</if>
  69. <if test="subordinateDepartmen != null">subordinate_departmen,</if>
  70. <if test="materielSpecies != null">materiel_species,</if>
  71. <if test="materielUse != null">materiel_use,</if>
  72. <if test="units != null">units,</if>
  73. <if test="specificationModel != null">specification_model,</if>
  74. <if test="status != null">status,</if>
  75. <if test="dataApprovalStatus != null">data_approval_status,</if>
  76. <if test="remark != null">remark,</if>
  77. <if test="createById != null">create_by_id,</if>
  78. <if test="createBy != null">create_by,</if>
  79. <if test="createTime != null">create_time,</if>
  80. <if test="updateById != null">update_by_id,</if>
  81. <if test="updateBy != null">update_by,</if>
  82. <if test="updateTime != null">update_time,</if>
  83. <if test="delFlag != null">del_flag,</if>
  84. <if test="taskProcessKey != null">task_process_key,</if>
  85. <if test="taskNodeKey != null">task_node_key,</if>
  86. <if test="materieEncoding != null">materie_encoding,</if>
  87. <if test="materieColorNumber != null">materie_color_number,</if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides=",">
  90. <if test="materielCode != null">#{materielCode},</if>
  91. <if test="materielName != null">#{materielName},</if>
  92. <if test="materielAsname != null">#{materielAsname},</if>
  93. <if test="subordinateDepartmen != null">#{subordinateDepartmen},</if>
  94. <if test="materielSpecies != null">#{materielSpecies},</if>
  95. <if test="materielUse != null">#{materielUse},</if>
  96. <if test="units != null">#{units},</if>
  97. <if test="specificationModel != null">#{specificationModel},</if>
  98. <if test="status != null">#{status},</if>
  99. <if test="dataApprovalStatus != null">#{dataApprovalStatus},</if>
  100. <if test="remark != null">#{remark},</if>
  101. <if test="createById != null">#{createById},</if>
  102. <if test="createBy != null">#{createBy},</if>
  103. <if test="createTime != null">#{createTime},</if>
  104. <if test="updateById != null">#{updateById},</if>
  105. <if test="updateBy != null">#{updateBy},</if>
  106. <if test="updateTime != null">#{updateTime},</if>
  107. <if test="delFlag != null">#{delFlag},</if>
  108. <if test="taskProcessKey != null">#{taskProcessKey},</if>
  109. <if test="taskNodeKey != null">#{taskNodeKey},</if>
  110. <if test="materieEncoding != null">#{materieEncoding},</if>
  111. <if test="materieColorNumber != null">#{materieColorNumber},</if>
  112. </trim>
  113. </insert>
  114. <update id="updateMateriel" parameterType="com.zkqy.business.domain.Materiel">
  115. update {DBNAME}.materiel
  116. <trim prefix="SET" suffixOverrides=",">
  117. <if test="materielCode != null">materiel_code = #{materielCode},</if>
  118. <if test="materielName != null">materiel_name = #{materielName},</if>
  119. <if test="materielAsname != null">materiel_asname = #{materielAsname},</if>
  120. <if test="subordinateDepartmen != null">subordinate_departmen = #{subordinateDepartmen},</if>
  121. <if test="materielSpecies != null">materiel_species = #{materielSpecies},</if>
  122. <if test="materielUse != null">materiel_use = #{materielUse},</if>
  123. <if test="units != null">units = #{units},</if>
  124. <if test="specificationModel != null">specification_model = #{specificationModel},</if>
  125. <if test="status != null">status = #{status},</if>
  126. <if test="dataApprovalStatus != null">data_approval_status = #{dataApprovalStatus},</if>
  127. <if test="remark != null">remark = #{remark},</if>
  128. <if test="createById != null">create_by_id = #{createById},</if>
  129. <if test="createBy != null">create_by = #{createBy},</if>
  130. <if test="createTime != null">create_time = #{createTime},</if>
  131. <if test="updateById != null">update_by_id = #{updateById},</if>
  132. <if test="updateBy != null">update_by = #{updateBy},</if>
  133. <if test="updateTime != null">update_time = #{updateTime},</if>
  134. <if test="delFlag != null">del_flag = #{delFlag},</if>
  135. <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
  136. <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
  137. <if test="materieEncoding != null">materie_encoding = #{materieEncoding},</if>
  138. <if test="materieColorNumber != null">materie_color_number = #{materieColorNumber},</if>
  139. </trim>
  140. where id = #{id}
  141. </update>
  142. <delete id="deleteMaterielById" parameterType="Long">
  143. delete from {DBNAME}.materiel where id = #{id}
  144. </delete>
  145. <delete id="deleteMaterielByIds" parameterType="String">
  146. delete from {DBNAME}.materiel where id in
  147. <foreach item="id" collection="array" open="(" separator="," close=")">
  148. #{id}
  149. </foreach>
  150. </delete>
  151. <select id="queryMaterielList" resultMap="MaterielResult">
  152. <include refid="selectMaterielVo"/>
  153. where del_flag = '0' and materiel_species = '1' order by materiel_name desc
  154. </select>
  155. </mapper>