荣鑫后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

248 lines
12 KiB

  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.gaotao.modules.toolman.dao.ToolHeaderMapper">
  4. <resultMap id="BaseResultMap" type="com.gaotao.modules.toolman.entity.ToolHeader">
  5. <!--@mbg.generated-->
  6. <!--@Table ToolHeader-->
  7. <id column="ToolID" jdbcType="VARCHAR" property="toolId" />
  8. <id column="Site" jdbcType="VARCHAR" property="site" />
  9. <result column="ToolDescription" jdbcType="VARCHAR" property="toolDescription" />
  10. <result column="Spec" jdbcType="VARCHAR" property="spec" />
  11. <result column="FamilyID" jdbcType="VARCHAR" property="familyId" />
  12. <result column="Active" jdbcType="CHAR" property="active" />
  13. <result column="Remark" jdbcType="VARCHAR" property="remark" />
  14. <result column="StandardCost" jdbcType="FLOAT" property="standardCost" />
  15. <result column="CodeNo" jdbcType="VARCHAR" property="codeNo" />
  16. <result column="CreateDate" jdbcType="TIMESTAMP" property="createDate" />
  17. <result column="CreatedBy" jdbcType="VARCHAR" property="createdBy" />
  18. <result column="UMID" jdbcType="VARCHAR" property="umid" />
  19. <result column="DefaultWarehouseID" jdbcType="VARCHAR" property="defaultWarehouseId" />
  20. <result column="LastUpdateBy" jdbcType="VARCHAR" property="lastUpdateBy" />
  21. <result column="DefaultLocationID" jdbcType="VARCHAR" property="defaultLocationId" />
  22. <result column="PartCreatedFlag" jdbcType="CHAR" property="partCreatedFlag" />
  23. <result column="PartNo" jdbcType="VARCHAR" property="partNo" />
  24. <result column="FamilyName" jdbcType="VARCHAR" property="familyName" />
  25. <result column="strActive" jdbcType="VARCHAR" property="strActive" />
  26. <result column="strPartCreated" jdbcType="VARCHAR" property="strPartCreated" />
  27. </resultMap>
  28. <sql id="Base_Column_List">
  29. <!--@mbg.generated-->
  30. ToolID, Site, ToolDescription, Spec, FamilyID, Active, Remark, StandardCost, CodeNo,
  31. CreateDate, CreatedBy, UMID, DefaultWarehouseID, LastUpdateBy, DefaultLocationID,
  32. PartCreatedFlag, PartNo
  33. </sql>
  34. <select id="getToolHeaderCount" resultType="Integer">
  35. <!--@mbg.generated-->
  36. select isnull(count(ToolID) ,0)
  37. from ToolHeader
  38. <where>
  39. <if test="site != null">
  40. and Site=#{site,jdbcType=VARCHAR}
  41. </if>
  42. <if test="toolId != null and toolId != ''">
  43. and ToolID = #{toolId,jdbcType=VARCHAR}
  44. </if>
  45. </where>
  46. </select>
  47. <select id="getToolHeaderList" resultMap="BaseResultMap">
  48. <!--@mbg.generated-->
  49. select
  50. <include refid="Base_Column_List"/>
  51. from ToolHeader
  52. <where>
  53. <if test="site != null">
  54. and Site=#{site,jdbcType=VARCHAR}
  55. </if>
  56. <if test="toolId != null and toolId != ''">
  57. and ToolID like '%' + #{toolId,jdbcType=VARCHAR} + '%'
  58. </if>
  59. <if test="toolDescription != null and toolDescription != ''">
  60. and ToolDescription like '%' + #{toolDescription,jdbcType=VARCHAR} + '%'
  61. </if>
  62. </where>
  63. </select>
  64. <delete id="deleteBySiteAndToolid">
  65. <!--@mbg.generated-->
  66. delete from ToolHeader
  67. <where>
  68. <if test="site != null">
  69. and Site=#{site,jdbcType=VARCHAR}
  70. </if>
  71. <if test="toolId != null and toolId != ''">
  72. and ToolID=#{toolId,jdbcType=VARCHAR}
  73. </if>
  74. </where>
  75. </delete>
  76. <insert id="insertList">
  77. <!--@mbg.generated-->
  78. INSERT INTO ToolHeader(
  79. ToolID,
  80. Site,
  81. ToolDescription,
  82. Spec,
  83. FamilyID,
  84. Active,
  85. Remark,
  86. StandardCost,
  87. CodeNo,
  88. CreateDate,
  89. CreatedBy,
  90. UMID,
  91. DefaultWarehouseID,
  92. LastUpdateBy,
  93. DefaultLocationID,
  94. PartCreatedFlag,
  95. PartNo
  96. )VALUES
  97. <foreach collection="list" item="element" index="index" separator=",">
  98. (
  99. #{element.toolId,jdbcType=VARCHAR},
  100. #{element.site,jdbcType=VARCHAR},
  101. #{element.toolDescription,jdbcType=VARCHAR},
  102. #{element.spec,jdbcType=VARCHAR},
  103. #{element.familyId,jdbcType=VARCHAR},
  104. #{element.active,jdbcType=CHAR},
  105. #{element.remark,jdbcType=VARCHAR},
  106. #{element.standardCost,jdbcType=DOUBLE},
  107. #{element.codeNo,jdbcType=VARCHAR},
  108. #{element.createDate,jdbcType=TIMESTAMP},
  109. #{element.createdBy,jdbcType=VARCHAR},
  110. #{element.umid,jdbcType=VARCHAR},
  111. #{element.defaultWarehouseId,jdbcType=VARCHAR},
  112. #{element.lastUpdateBy,jdbcType=VARCHAR},
  113. #{element.defaultLocationId,jdbcType=VARCHAR},
  114. #{element.partCreatedFlag,jdbcType=VARCHAR},
  115. #{element.partNo,jdbcType=VARCHAR}
  116. )
  117. </foreach>
  118. </insert>
  119. <insert id="insertSelective">
  120. <!--@mbg.generated-->
  121. INSERT INTO ToolHeader
  122. <trim prefix="(" suffix=")" suffixOverrides=",">
  123. <if test="toolId != null and toolId != ''">ToolID,</if>
  124. <if test="site != null and site != ''">Site,</if>
  125. <if test="toolDescription != null and toolDescription != ''">ToolDescription,</if>
  126. <if test="spec != null and spec != ''">Spec,</if>
  127. <if test="familyId != null and familyId != ''">FamilyID,</if>
  128. <if test="active != null and active != ''">Active,</if>
  129. <if test="remark != null and remark != ''">Remark,</if>
  130. <if test="standardCost != null">StandardCost,</if>
  131. <if test="codeNo != null and codeNo != ''">CodeNo,</if>
  132. <if test="createDate != null">CreateDate,</if>
  133. <if test="createdBy != null and createdBy != ''">CreatedBy,</if>
  134. <if test="umid != null and umid != ''">UMID,</if>
  135. <if test="defaultWarehouseId != null and defaultWarehouseId != ''">DefaultWarehouseID,</if>
  136. <if test="lastUpdateBy != null and lastUpdateBy != ''">LastUpdateBy,</if>
  137. <if test="defaultLocationId != null and defaultLocationId != ''">DefaultLocationID,</if>
  138. <if test="partCreatedFlag != null and partCreatedFlag != ''">PartCreatedFlag,</if>
  139. <if test="partNo != null and partNo != ''">PartNo</if>
  140. </trim>
  141. VALUES
  142. <trim prefix="(" suffix=")" suffixOverrides=",">
  143. <if test="toolId != null and toolId != ''">#{toolId,jdbcType=VARCHAR},</if>
  144. <if test="site != null and site != ''">#{site,jdbcType=VARCHAR},</if>
  145. <if test="toolDescription != null and toolDescription != ''">#{toolDescription,jdbcType=VARCHAR},</if>
  146. <if test="spec != null and spec != ''">#{spec,jdbcType=VARCHAR},</if>
  147. <if test="familyId != null and familyId != ''">#{familyId,jdbcType=VARCHAR},</if>
  148. <if test="active != null and active != ''">#{active,jdbcType=CHAR},</if>
  149. <if test="remark != null and remark != ''">#{remark,jdbcType=VARCHAR},</if>
  150. <if test="standardCost != null">#{standardCost,jdbcType=DOUBLE},</if>
  151. <if test="codeNo != null and codeNo != ''">#{codeNo,jdbcType=VARCHAR},</if>
  152. <if test="createDate != null">#{createDate,jdbcType=TIMESTAMP},</if>
  153. <if test="createdBy != null and createdBy != ''">#{createdBy,jdbcType=VARCHAR},</if>
  154. <if test="umid != null and umid != ''">#{umid,jdbcType=VARCHAR},</if>
  155. <if test="defaultWarehouseId != null and defaultWarehouseId != ''">#{defaultWarehouseId,jdbcType=VARCHAR},</if>
  156. <if test="lastUpdateBy != null and lastUpdateBy != ''">#{lastUpdateBy,jdbcType=VARCHAR},</if>
  157. <if test="defaultLocationId != null and defaultLocationId != ''">#{defaultLocationId,jdbcType=VARCHAR},</if>
  158. <if test="partCreatedFlag != null and partCreatedFlag != ''">#{partCreatedFlag,jdbcType=VARCHAR},</if>
  159. <if test="partNo != null and partNo != ''">#{partNo,jdbcType=VARCHAR}</if>
  160. </trim>
  161. </insert>
  162. <update id="updateBySiteAndToolid">
  163. <!--@mbg.generated-->
  164. update ToolHeader
  165. <set>
  166. <if test="toolId != null and toolId != ''">
  167. ToolID = #{toolId,jdbcType=VARCHAR},
  168. </if>
  169. <if test="site != null and site != ''">
  170. Site = #{site,jdbcType=VARCHAR},
  171. </if>
  172. <if test="toolDescription != null and toolDescription != ''">
  173. ToolDescription = #{toolDescription,jdbcType=VARCHAR},
  174. </if>
  175. <if test="spec != null and spec != ''">
  176. Spec = #{spec,jdbcType=VARCHAR},
  177. </if>
  178. <if test="familyId != null and familyId != ''">
  179. FamilyID = #{familyId,jdbcType=VARCHAR},
  180. </if>
  181. <if test="active != null and active != ''">
  182. Active = #{active,jdbcType=CHAR},
  183. </if>
  184. <if test="remark != null and remark != ''">
  185. Remark = #{remark,jdbcType=VARCHAR},
  186. </if>
  187. <if test="standardCost != null">
  188. StandardCost = #{standardCost,jdbcType=DOUBLE},
  189. </if>
  190. <if test="codeNo != null and codeNo != ''">
  191. CodeNo = #{codeNo,jdbcType=VARCHAR},
  192. </if>
  193. <if test="createDate != null">
  194. CreateDate = #{createDate,jdbcType=TIMESTAMP},
  195. </if>
  196. <if test="createdBy != null and createdBy != ''">
  197. CreatedBy = #{createdBy,jdbcType=VARCHAR},
  198. </if>
  199. <if test="umid != null and umid != ''">
  200. UMID = #{umid,jdbcType=VARCHAR},
  201. </if>
  202. <if test="defaultWarehouseId != null and defaultWarehouseId != ''">
  203. DefaultWarehouseID = #{defaultWarehouseId,jdbcType=VARCHAR},
  204. </if>
  205. <if test="lastUpdateBy != null and lastUpdateBy != ''">
  206. LastUpdateBy = #{lastUpdateBy,jdbcType=VARCHAR},
  207. </if>
  208. <if test="defaultLocationId != null and defaultLocationId != ''">
  209. DefaultLocationID = #{defaultLocationId,jdbcType=VARCHAR},
  210. </if>
  211. <if test="partCreatedFlag != null and partCreatedFlag != ''">
  212. PartCreatedFlag = #{partCreatedFlag,jdbcType=VARCHAR},
  213. </if>
  214. <if test="partNo != null and partNo != ''">
  215. PartNo = #{partNo,jdbcType=VARCHAR},
  216. </if>
  217. </set>
  218. <where>
  219. <if test="site != null">
  220. and Site=#{site,jdbcType=VARCHAR}
  221. </if>
  222. <if test="toolId != null and toolId != ''">
  223. and ToolID=#{toolId,jdbcType=VARCHAR}
  224. </if>
  225. </where>
  226. </update>
  227. <select id="getToolHeaderData" resultMap="BaseResultMap">
  228. select top 1 A.ToolID,A.Site,A.ToolDescription,A.Spec,A.FamilyID,A.Active,A.Remark,A.StandardCost,A.CodeNo
  229. ,A.CreateDate,A.CreatedBy,A.UMID,A.DefaultWarehouseID,A.LastUpdateBy,A.DefaultLocationID,A.PartCreatedFlag
  230. ,A.PartNo ,convert(varchar(100) ,A.CreateDate ,23) as strCreateDate
  231. ,(case A.Active when 'Y' then '是' else '否' end) as strActive
  232. ,(case A.PartCreatedFlag when 'Y' then '是' else '否' end) as strPartCreated
  233. ,B.FamilyName
  234. from ToolHeader A
  235. left join PartFamily B on A.site = B.site and A.FamilyID = B.FamilyID
  236. <where>
  237. <if test="site != null and site != ''">
  238. and A.Site = #{site,jdbcType=VARCHAR}
  239. </if>
  240. <if test="toolId != null and toolId != ''">
  241. and A.ToolID = #{toolId,jdbcType=VARCHAR}
  242. </if>
  243. <if test="toolDescription != null and toolDescription != ''">
  244. and A.ToolDescription = #{toolDescription,jdbcType=VARCHAR}
  245. </if>
  246. </where>
  247. order by A.ToolID
  248. </select>
  249. </mapper>