CodeSkuRelationshipMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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.base.mapper.CodeSkuRelationshipMapper">
  6. <resultMap type="CodeSkuRelationship" id="CodeSkuRelationshipResult">
  7. <result property="id" column="id" />
  8. <result property="sn" column="sn" />
  9. <result property="status" column="status" />
  10. <result property="sku" column="sku" />
  11. <result property="vdate" column="vdate" />
  12. <result property="userId" column="user_id" />
  13. <result property="createBy" column="create_by" />
  14. <result property="createTime" column="create_time" />
  15. <result property="updateBy" column="update_by" />
  16. <result property="updateTime" column="update_time" />
  17. </resultMap>
  18. <resultMap type="codeSkuRelationshipVO" id="CodeSkuRelationshipVOResult">
  19. <result property="sn" column="sn" />
  20. <result property="status" column="status" />
  21. <result property="sku" column="sku" />
  22. <result property="skuName" column="desc1" />
  23. <result property="skuType" column="sku_type" />
  24. <result property="model" column="model" />
  25. </resultMap>
  26. <sql id="selectCodeSkuRelationshipVo">
  27. select id, sn, status, sku, vdate, user_id, create_by, create_time, update_by, update_time from code_sku_relationship
  28. </sql>
  29. <select id="selectCodeSkuRelationshipList" parameterType="CodeSkuRelationshipVO" resultMap="CodeSkuRelationshipResult">
  30. <include refid="selectCodeSkuRelationshipVo"/>
  31. <where>
  32. <if test="sn != null and sn != ''"> and sn = #{sn}</if>
  33. <if test="status != null and status != ''"> and status = #{status}</if>
  34. <if test="sku != null and sku != ''"> and sku = #{sku}</if>
  35. <if test="vdate != null "> and vdate = #{vdate}</if>
  36. <if test="userId != null and userId != ''"> and user_id = #{userId}</if>
  37. </where>
  38. </select>
  39. <select id="selectCodeSkuRelationshipById" parameterType="Long" resultMap="CodeSkuRelationshipResult">
  40. <include refid="selectCodeSkuRelationshipVo"/>
  41. where id = #{id}
  42. </select>
  43. <insert id="insertCodeSkuRelationship" parameterType="CodeSkuRelationshipVO" useGeneratedKeys="true" keyProperty="id">
  44. insert into code_sku_relationship
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="sn != null">sn,</if>
  47. <if test="status != null">status,</if>
  48. <if test="sku != null">sku,</if>
  49. <if test="vdate != null">vdate,</if>
  50. <if test="userId != null">user_id,</if>
  51. <if test="createBy != null">create_by,</if>
  52. <if test="createTime != null">create_time,</if>
  53. <if test="updateBy != null">update_by,</if>
  54. <if test="updateTime != null">update_time,</if>
  55. </trim>
  56. <trim prefix="values (" suffix=")" suffixOverrides=",">
  57. <if test="sn != null">#{sn},</if>
  58. <if test="status != null">#{status},</if>
  59. <if test="sku != null">#{sku},</if>
  60. <if test="vdate != null">#{vdate},</if>
  61. <if test="userId != null">#{userId},</if>
  62. <if test="createBy != null">#{createBy},</if>
  63. <if test="createTime != null">#{createTime},</if>
  64. <if test="updateBy != null">#{updateBy},</if>
  65. <if test="updateTime != null">#{updateTime},</if>
  66. </trim>
  67. </insert>
  68. <update id="updateCodeSkuRelationship" parameterType="CodeSkuRelationship">
  69. update code_sku_relationship
  70. <trim prefix="SET" suffixOverrides=",">
  71. <if test="sn != null">sn = #{sn},</if>
  72. <if test="status != null">status = #{status},</if>
  73. <if test="sku != null">sku = #{sku},</if>
  74. <if test="vdate != null">vdate = #{vdate},</if>
  75. <if test="userId != null">user_id = #{userId},</if>
  76. <if test="createBy != null">create_by = #{createBy},</if>
  77. <if test="createTime != null">create_time = #{createTime},</if>
  78. <if test="updateBy != null">update_by = #{updateBy},</if>
  79. <if test="updateTime != null">update_time = #{updateTime},</if>
  80. </trim>
  81. where id = #{id}
  82. </update>
  83. <delete id="deleteCodeSkuRelationshipById" parameterType="Long">
  84. delete from code_sku_relationship where id = #{id}
  85. </delete>
  86. <delete id="deleteCodeSkuRelationshipByIds" parameterType="String">
  87. delete from code_sku_relationship where id in
  88. <foreach item="id" collection="array" open="(" separator="," close=")">
  89. #{id}
  90. </foreach>
  91. </delete>
  92. <select id="selectCodeSkuRelationshipBySn" parameterType="string" resultMap="CodeSkuRelationshipVOResult">
  93. select c.sn,c.status,s.sku,s.desc1,s.sku_type,s.model
  94. from code_sku_relationship c
  95. left join base_sku s on c.sku = s.sku
  96. where c.sn = #{sn} and c.status = 'Y'
  97. </select>
  98. <select id="selectCodeSkuRelationshipVOList" resultType="com.ruoyi.base.domain.vo.CodeSkuRelationshipVO">
  99. <include refid="selectCodeSkuRelationshipVo"/>
  100. where 1=1
  101. <if test="list != null">
  102. and sn in
  103. <foreach collection="list" index="index" item="item" open="(" close=")" separator=",">
  104. #{item}
  105. </foreach>
  106. </if>
  107. </select>
  108. </mapper>