InterestsTableMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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.system.mapper.InterestsTableMapper">
  6. <resultMap type="InterestsTable" id="InterestsTableResult">
  7. <result property="id" column="id" />
  8. <result property="merchantsId" column="merchants_id" />
  9. <result property="merchantsName" column="merchants_name" />
  10. <result property="interestsPolicyId" column="interests_policy_id" />
  11. <result property="interestsPolicyName" column="interests_policy_name" />
  12. <result property="account" column="account" />
  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. <result property="isDel" column="is_del" />
  18. <collection property="interestsNumberTableList" javaType="java.util.List" resultMap="InterestsNumberTableResult"/>
  19. </resultMap>
  20. <resultMap type="InterestsNumberTable" id="InterestsNumberTableResult">
  21. <result property="id" column="id" />
  22. <result property="interestsId" column="interests_id" />
  23. <result property="rightsRank" column="rights_rank" />
  24. <result property="number" column="number" />
  25. <result property="numberId" column="numberId" />
  26. </resultMap>
  27. <sql id="selectInterestsTableVo">
  28. select id, merchants_id, merchants_name,interests_policy_id,interests_policy_name, account, create_by, create_time, update_by, update_time, is_del from interests_table
  29. </sql>
  30. <select id="selectInterestsTableList" parameterType="InterestsTable" resultMap="InterestsTableResult">
  31. select i.id, i.merchants_id, i.merchants_name,i.interests_policy_id,i.interests_policy_name, i.account, i.create_by, i.create_time, i.update_by, i.update_time, i.is_del,
  32. n.interests_id, n.rights_rank, n.number
  33. from interests_table i
  34. left join interests_number_table n on i.id = n.interests_id
  35. <where>
  36. <if test="merchantsName != null and merchantsName != ''"> and merchants_name like concat('%', #{merchantsName}, '%')</if>
  37. <if test="account != null and account != ''"> and account = #{account}</if>
  38. <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
  39. </where>
  40. </select>
  41. <select id="selectInterestsTableById" parameterType="Long" resultMap="InterestsTableResult">
  42. select i.id, i.merchants_id, i.merchants_name,i.interests_policy_id,i.interests_policy_name, i.account, i.create_by, i.create_time, i.update_by, i.update_time, i.is_del,
  43. n.id as numberId, n.interests_id, n.rights_rank, n.number
  44. from interests_table i
  45. left join interests_number_table n on i.id = n.interests_id
  46. where i.id = #{id}
  47. </select>
  48. <insert id="insertInterestsTable" parameterType="InterestsTable" useGeneratedKeys="true" keyProperty="id">
  49. insert into interests_table
  50. <trim prefix="(" suffix=")" suffixOverrides=",">
  51. <if test="merchantsId != null">merchants_id,</if>
  52. <if test="merchantsName != null and merchantsName != ''">merchants_name,</if>
  53. <if test="interestsPolicyId != null and interestsPolicyId != ''">interests_policy_id,</if>
  54. <if test="interestsPolicyName != null and interestsPolicyName != ''">interests_policy_name,</if>
  55. <if test="account != null">account,</if>
  56. <if test="createBy != null">create_by,</if>
  57. <if test="createTime != null">create_time,</if>
  58. <if test="updateBy != null">update_by,</if>
  59. <if test="updateTime != null">update_time,</if>
  60. <if test="isDel != null and isDel != ''">is_del,</if>
  61. </trim>
  62. <trim prefix="values (" suffix=")" suffixOverrides=",">
  63. <if test="merchantsId != null">#{merchantsId},</if>
  64. <if test="merchantsName != null and merchantsName != ''">#{merchantsName},</if>
  65. <if test="interestsPolicyId != null and interestsPolicyId != ''">#{interestsPolicyId},</if>
  66. <if test="interestsPolicyName != null and interestsPolicyName != ''">#{interestsPolicyName},</if>
  67. <if test="account != null">#{account},</if>
  68. <if test="createBy != null">#{createBy},</if>
  69. <if test="createTime != null">#{createTime},</if>
  70. <if test="updateBy != null">#{updateBy},</if>
  71. <if test="updateTime != null">#{updateTime},</if>
  72. <if test="isDel != null and isDel != ''">#{isDel},</if>
  73. </trim>
  74. </insert>
  75. <update id="updateInterestsTable" parameterType="InterestsTable">
  76. update interests_table
  77. <trim prefix="SET" suffixOverrides=",">
  78. <if test="merchantsId != null">merchants_id = #{merchantsId},</if>
  79. <if test="merchantsName != null and merchantsName != ''">merchants_name = #{merchantsName},</if>
  80. <if test="interestsPolicyId != null and interestsPolicyId != ''">interests_policy_id = #{interestsPolicyId},</if>
  81. <if test="interestsPolicyName != null and interestsPolicyName != ''">interests_policy_name = #{interestsPolicyName},</if>
  82. <if test="account != null">account = #{account},</if>
  83. <if test="createBy != null">create_by = #{createBy},</if>
  84. <if test="createTime != null">create_time = #{createTime},</if>
  85. <if test="updateBy != null">update_by = #{updateBy},</if>
  86. <if test="updateTime != null">update_time = #{updateTime},</if>
  87. <if test="isDel != null and isDel != ''">is_del = #{isDel},</if>
  88. </trim>
  89. where id = #{id}
  90. </update>
  91. <delete id="deleteInterestsTableById" parameterType="Long">
  92. delete from interests_table where id = #{id}
  93. </delete>
  94. <delete id="deleteInterestsTableByIds" parameterType="String">
  95. delete from interests_table where id in
  96. <foreach item="id" collection="array" open="(" separator="," close=")">
  97. #{id}
  98. </foreach>
  99. </delete>
  100. </mapper>