TGoodsMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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="ifCntrno" column="if_cntrno" />
  18. <result property="fStatus" column="f_status" />
  19. <result property="delFlag" column="del_flag" />
  20. <result property="createBy" column="create_by" />
  21. <result property="createTime" column="create_time" />
  22. <result property="updateBy" column="update_by" />
  23. <result property="updateTime" column="update_time" />
  24. <result property="remark" column="remark" />
  25. </resultMap>
  26. <sql id="selectTGoodsVo">
  27. select f_id, f_typeid, f_no, f_name, f_enam, f_specs, f_packagespecs, f_color, f_hscode, f_packageid, if_cntrno, f_status, del_flag, create_by, create_time, update_by, update_time, remark from t_goods
  28. </sql>
  29. <select id="selectTGoodsList" parameterType="TGoods" resultMap="TGoodsResult">
  30. <include refid="selectTGoodsVo"/>
  31. <where>
  32. <if test="fTypeid != null and fTypeid != ''">and f_typeid = #{fTypeid}</if>
  33. <if test="ifCntrno != null and ifCntrno != ''">and if_cntrno = #{ifCntrno}</if>
  34. <if test="fNo != null and fNo != ''">and f_no like concat('%', #{fNo}, '%')</if>
  35. <if test="fName != null and fName != ''">and f_name like concat('%', #{fName}, '%')</if>
  36. <if test="fEnam != null and fEnam != ''">and f_enam like concat('%', #{fEnam}, '%')</if>
  37. <if test="fSpecs != null and fSpecs != ''">and f_specs like concat('%', #{fSpecs}, '%')</if>
  38. <if test="fPackagespecs != null ">and f_packagespecs like concat('%', #{fPackagespecs}, '%')</if>
  39. <if test="fColor != null and fColor != ''">and f_color like concat('%', #{fColor}, '%')</if>
  40. <if test="fHscode != null and fHscode != ''">and f_hscode like concat('%', #{fHscode}, '%')</if>
  41. <if test="fPackageid != null ">and f_packageid = #{fPackageid}</if>
  42. <if test="fStatus != null and fStatus != ''">and f_status = #{fStatus}</if>
  43. </where>
  44. </select>
  45. <select id="selectTGoodsById" parameterType="Long" resultMap="TGoodsResult">
  46. <include refid="selectTGoodsVo"/>
  47. where f_id = #{fId}
  48. </select>
  49. <insert id="insertTGoods" parameterType="TGoods" useGeneratedKeys="true" keyProperty="fId">
  50. insert into t_goods
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="fTypeid != null">f_typeid,</if>
  53. <if test="fNo != null and fNo != ''">f_no,</if>
  54. <if test="fName != null and fName != ''">f_name,</if>
  55. <if test="fEnam != null and fEnam != ''">f_enam,</if>
  56. <if test="fSpecs != null and fSpecs != ''">f_specs,</if>
  57. <if test="fPackagespecs != null">f_packagespecs,</if>
  58. <if test="fColor != null">f_color,</if>
  59. <if test="fHscode != null">f_hscode,</if>
  60. <if test="fPackageid != null">f_packageid,</if>
  61. <if test="ifCntrno != null">if_cntrno,</if>
  62. <if test="fStatus != null">f_status,</if>
  63. <if test="delFlag != null">del_flag,</if>
  64. <if test="createBy != null">create_by,</if>
  65. <if test="createTime != null">create_time,</if>
  66. <if test="updateBy != null">update_by,</if>
  67. <if test="updateTime != null">update_time,</if>
  68. <if test="remark != null">remark,</if>
  69. </trim>
  70. <trim prefix="values (" suffix=")" suffixOverrides=",">
  71. <if test="fTypeid != null">#{fTypeid},</if>
  72. <if test="fNo != null and fNo != ''">#{fNo},</if>
  73. <if test="fName != null and fName != ''">#{fName},</if>
  74. <if test="fEnam != null and fEnam != ''">#{fEnam},</if>
  75. <if test="fSpecs != null and fSpecs != ''">#{fSpecs},</if>
  76. <if test="fPackagespecs != null">#{fPackagespecs},</if>
  77. <if test="fColor != null">#{fColor},</if>
  78. <if test="fHscode != null">#{fHscode},</if>
  79. <if test="fPackageid != null">#{fPackageid},</if>
  80. <if test="ifCntrno != null">#{ifCntrno},</if>
  81. <if test="fStatus != null">#{fStatus},</if>
  82. <if test="delFlag != null">#{delFlag},</if>
  83. <if test="createBy != null">#{createBy},</if>
  84. <if test="createTime != null">#{createTime},</if>
  85. <if test="updateBy != null">#{updateBy},</if>
  86. <if test="updateTime != null">#{updateTime},</if>
  87. <if test="remark != null">#{remark},</if>
  88. </trim>
  89. </insert>
  90. <update id="updateTGoods" parameterType="TGoods">
  91. update t_goods
  92. <trim prefix="SET" suffixOverrides=",">
  93. <if test="fTypeid != null">f_typeid = #{fTypeid},</if>
  94. <if test="fNo != null and fNo != ''">f_no = #{fNo},</if>
  95. <if test="fName != null and fName != ''">f_name = #{fName},</if>
  96. <if test="fEnam != null and fEnam != ''">f_enam = #{fEnam},</if>
  97. <if test="fSpecs != null and fSpecs != ''">f_specs = #{fSpecs},</if>
  98. <if test="fPackagespecs != null">f_packagespecs = #{fPackagespecs},</if>
  99. <if test="fColor != null">f_color = #{fColor},</if>
  100. <if test="fHscode != null">f_hscode = #{fHscode},</if>
  101. <if test="fPackageid != null">f_packageid = #{fPackageid},</if>
  102. <if test="ifCntrno != null">if_cntrno = #{ifCntrno},</if>
  103. <if test="fStatus != null">f_status = #{fStatus},</if>
  104. <if test="delFlag != null">del_flag = #{delFlag},</if>
  105. <if test="createBy != null">create_by = #{createBy},</if>
  106. <if test="createTime != null">create_time = #{createTime},</if>
  107. <if test="updateBy != null">update_by = #{updateBy},</if>
  108. <if test="updateTime != null">update_time = #{updateTime},</if>
  109. <if test="remark != null">remark = #{remark},</if>
  110. </trim>
  111. where f_id = #{fId}
  112. </update>
  113. <delete id="deleteTGoodsById" parameterType="Long">
  114. delete from t_goods where f_id = #{fId}
  115. </delete>
  116. <delete id="deleteTGoodsByIds" parameterType="String">
  117. delete from t_goods where f_id in
  118. <foreach item="fId" collection="array" open="(" separator="," close=")">
  119. #{fId}
  120. </foreach>
  121. </delete>
  122. <select id="checkFNoUnique" parameterType="String" resultMap="TGoodsResult">
  123. select f_id,f_no from t_goods where f_no = #{fNo} limit 1
  124. </select>
  125. <select id="checkUFNnameUnique" parameterType="String" resultMap="TGoodsResult">
  126. select f_id,f_name from t_goods where f_name = #{fAame} limit 1
  127. </select>
  128. <select id="getGoodName" parameterType="string" resultType="map">
  129. SELECT
  130. t.f_id fId,
  131. t.f_name fName,
  132. pro.dict_label typeName
  133. FROM
  134. t_goods t
  135. LEFT JOIN sys_dict_data pro ON pro.dict_value = t.f_typeid and pro.dict_type = 'data_goods_category'
  136. WHERE t.f_status = '0'
  137. </select>
  138. </mapper>