TGoodsMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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.ruoyi.basicData.mapper.TGoodsMapper">
  6. <resultMap type="TGoods" id="TGoodsResult">
  7. <result property="fId" column="f_id" />
  8. <result property="fTypeid" column="f_typeid" />
  9. <result property="fNo" column="f_no" />
  10. <result property="fName" column="f_name" />
  11. <result property="fEnam" column="f_enam" />
  12. <result property="fSpecs" column="f_specs" />
  13. <result property="fPackagespecs" column="f_packagespecs" />
  14. <result property="fColor" column="f_color" />
  15. <result property="fHscode" column="f_hscode" />
  16. <result property="fPackageid" column="f_packageid" />
  17. <result property="fEmsNo" column="f_ems_no" />
  18. <result property="fEmsSeqNo" column="f_ems_seq_no" />
  19. <result property="fGoodsTs" column="f_goods_ts" />
  20. <result property="fWmsDclUnit" column="f_wms_dcl_unit" />
  21. <result property="fWmsLawUnit" column="f_wms_law_unit" />
  22. <result property="ifCntrno" column="if_cntrno" />
  23. <result property="fStatus" column="f_status" />
  24. <result property="delFlag" column="del_flag" />
  25. <result property="createBy" column="create_by" />
  26. <result property="createTime" column="create_time" />
  27. <result property="updateBy" column="update_by" />
  28. <result property="updateTime" column="update_time" />
  29. <result property="remark" column="remark" />
  30. <result property="stockWarning" column="stock_warning" />
  31. </resultMap>
  32. <sql id="selectTGoodsVo">
  33. select f_id, f_typeid, f_no, f_name, f_enam, f_specs, f_packagespecs, f_color, f_hscode, f_packageid, f_ems_no, f_ems_seq_no, f_goods_ts, f_wms_dcl_unit, f_wms_law_unit, if_cntrno, f_status, del_flag, create_by, create_time, update_by, update_time, remark,stock_warning from t_goods
  34. </sql>
  35. <select id="selectTGoodsList" parameterType="TGoods" resultMap="TGoodsResult">
  36. <include refid="selectTGoodsVo"/>
  37. <where>
  38. <if test="fTypeid != null and fTypeid != ''">and f_typeid = #{fTypeid}</if>
  39. <if test="ifCntrno != null and ifCntrno != ''">and if_cntrno = #{ifCntrno}</if>
  40. <if test="fNo != null and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
  41. <if test="fName != null and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
  42. <if test="fEnam != null and fEnam != ''">and f_enam like concat('%', #{fEnam}, '%')</if>
  43. <if test="fSpecs != null and fSpecs != ''">and f_specs like concat('%', #{fSpecs}, '%')</if>
  44. <if test="fPackagespecs != null ">and f_packagespecs like concat('%', #{fPackagespecs}, '%')</if>
  45. <if test="fColor != null and fColor != ''">and f_color like concat('%', #{fColor}, '%')</if>
  46. <if test="fHscode != null and fHscode != ''">and f_hscode like concat('%', #{fHscode}, '%')</if>
  47. <if test="fPackageid != null ">and f_packageid = #{fPackageid}</if>
  48. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  49. <if test="stockWarning != null ">and stock_warning = #{stockWarning}</if>
  50. </where>
  51. </select>
  52. <select id="selectTGoodsById" parameterType="Long" resultMap="TGoodsResult">
  53. <include refid="selectTGoodsVo"/>
  54. where f_id = #{fId}
  55. </select>
  56. <insert id="insertTGoods" parameterType="TGoods" useGeneratedKeys="true" keyProperty="fId">
  57. insert into t_goods
  58. <trim prefix="(" suffix=")" suffixOverrides=",">
  59. <if test="fTypeid != null">f_typeid,</if>
  60. <if test="fNo != null and fNo != ''">f_no,</if>
  61. <if test="fName != null and fName != ''">f_name,</if>
  62. <if test="fEnam != null and fEnam != ''">f_enam,</if>
  63. <if test="fSpecs != null and fSpecs != ''">f_specs,</if>
  64. <if test="fPackagespecs != null">f_packagespecs,</if>
  65. <if test="fColor != null">f_color,</if>
  66. <if test="fHscode != null">f_hscode,</if>
  67. <if test="fPackageid != null">f_packageid,</if>
  68. <if test="fEmsNo != null">f_ems_no,</if>
  69. <if test="fEmsSeqNo != null">f_ems_seq_no,</if>
  70. <if test="fGoodsTs != null">f_goods_ts,</if>
  71. <if test="fWmsDclUnit != null">f_wms_dcl_unit,</if>
  72. <if test="fWmsLawUnit != null">f_wms_law_unit,</if>
  73. <if test="ifCntrno != null">if_cntrno,</if>
  74. <if test="fStatus != null">f_status,</if>
  75. <if test="delFlag != null">del_flag,</if>
  76. <if test="createBy != null">create_by,</if>
  77. <if test="createTime != null">create_time,</if>
  78. <if test="updateBy != null">update_by,</if>
  79. <if test="updateTime != null">update_time,</if>
  80. <if test="remark != null">remark,</if>
  81. <if test="stockWarning != null ">stock_warning,</if>
  82. </trim>
  83. <trim prefix="values (" suffix=")" suffixOverrides=",">
  84. <if test="fTypeid != null">#{fTypeid},</if>
  85. <if test="fNo != null and fNo != ''">#{fNo},</if>
  86. <if test="fName != null and fName != ''">#{fName},</if>
  87. <if test="fEnam != null and fEnam != ''">#{fEnam},</if>
  88. <if test="fSpecs != null and fSpecs != ''">#{fSpecs},</if>
  89. <if test="fPackagespecs != null">#{fPackagespecs},</if>
  90. <if test="fColor != null">#{fColor},</if>
  91. <if test="fHscode != null">#{fHscode},</if>
  92. <if test="fPackageid != null">#{fPackageid},</if>
  93. <if test="fEmsNo != null">#{fEmsNo},</if>
  94. <if test="fEmsSeqNo != null">#{fEmsSeqNo},</if>
  95. <if test="fGoodsTs != null">#{fGoodsTs},</if>
  96. <if test="fWmsDclUnit != null">#{fWmsDclUnit},</if>
  97. <if test="fWmsLawUnit != null">#{fWmsLawUnit},</if>
  98. <if test="ifCntrno != null">#{ifCntrno},</if>
  99. <if test="fStatus != null">#{fStatus},</if>
  100. <if test="delFlag != null">#{delFlag},</if>
  101. <if test="createBy != null">#{createBy},</if>
  102. <if test="createTime != null">#{createTime},</if>
  103. <if test="updateBy != null">#{updateBy},</if>
  104. <if test="updateTime != null">#{updateTime},</if>
  105. <if test="remark != null">#{remark},</if>
  106. <if test="stockWarning != null ">#{stockWarning},</if>
  107. </trim>
  108. </insert>
  109. <update id="updateTGoods" parameterType="TGoods">
  110. update t_goods
  111. <trim prefix="SET" suffixOverrides=",">
  112. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  113. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  114. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  115. <if test="fEnam != null and fEnam != ''">f_enam = #{fEnam},</if>
  116. <if test="fSpecs != null and fSpecs != ''">f_specs = #{fSpecs},</if>
  117. <if test="fPackagespecs != null">f_packagespecs = #{fPackagespecs},</if>
  118. <if test="fColor != null">f_color = #{fColor},</if>
  119. <if test="fHscode != null">f_hscode = #{fHscode},</if>
  120. <if test="fPackageid != null">f_packageid = #{fPackageid},</if>
  121. <if test="fEmsNo != null">f_ems_no = #{fEmsNo},</if>
  122. <if test="fEmsSeqNo != null">f_ems_seq_no = #{fEmsSeqNo},</if>
  123. <if test="fGoodsTs != null">f_goods_ts = #{fGoodsTs},</if>
  124. <if test="fWmsDclUnit != null">f_wms_dcl_unit = #{fWmsDclUnit},</if>
  125. <if test="fWmsLawUnit != null">f_wms_law_unit = #{fWmsLawUnit},</if>
  126. <if test="ifCntrno != null">if_cntrno = #{ifCntrno},</if>
  127. <if test="fStatus != null">f_status = #{fStatus},</if>
  128. <if test="delFlag != null">del_flag = #{delFlag},</if>
  129. <if test="createBy != null">create_by = #{createBy},</if>
  130. <if test="createTime != null">create_time = #{createTime},</if>
  131. <if test="updateBy != null">update_by = #{updateBy},</if>
  132. <if test="updateTime != null">update_time = #{updateTime},</if>
  133. <if test="remark != null">remark = #{remark},</if>
  134. <if test="stockWarning != null ">stock_warning = #{stockWarning}</if>
  135. </trim>
  136. where f_id = #{fId}
  137. </update>
  138. <delete id="deleteTGoodsById" parameterType="Long">
  139. delete from t_goods where f_id = #{fId}
  140. </delete>
  141. <delete id="deleteTGoodsByIds" parameterType="String">
  142. delete from t_goods where f_id in
  143. <foreach item="fId" collection="array" open="(" separator="," close=")">
  144. #{fId}
  145. </foreach>
  146. </delete>
  147. <select id="checkFNoUnique" parameterType="String" resultMap="TGoodsResult">
  148. select f_id,f_no from t_goods where f_no = #{fNo} limit 1
  149. </select>
  150. <select id="checkUFNnameUnique" parameterType="String" resultMap="TGoodsResult">
  151. select f_id,f_name from t_goods where f_name = #{fAame} limit 1
  152. </select>
  153. <select id="getGoodName" parameterType="string" resultType="map">
  154. SELECT
  155. t.f_id fId,
  156. t.f_name fName,
  157. pro.dict_label typeName
  158. FROM
  159. t_goods t
  160. LEFT JOIN sys_dict_data pro ON pro.dict_value = t.f_typeid and pro.dict_type = 'data_goods_category'
  161. WHERE t.f_status = '0'
  162. </select>
  163. <select id="selectByIds" resultMap="TGoodsResult">
  164. SELECT f_id, f_typeid, f_no, f_name
  165. FROM
  166. t_goods
  167. where
  168. f_id in
  169. <foreach item="id" collection="ids" open="(" separator="," close=")">
  170. #{id}
  171. </foreach>
  172. </select>
  173. <select id="getGoodsByNo" parameterType="String" resultMap="TGoodsResult">
  174. <include refid="selectTGoodsVo"/>
  175. where f_no = #{fNo} limit 1
  176. </select>
  177. <select id="getGoodsByName" parameterType="String" resultMap="TGoodsResult">
  178. <include refid="selectTGoodsVo"/>
  179. where f_name = #{fName} limit 1
  180. </select>
  181. </mapper>