TGoodsMapper.xml 10 KB

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