TCustomerManageMapper.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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.web.pcApi.mapper.TCustomerManageMapper">
  6. <resultMap type="TCustomerManage" id="TCustomerManageResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="username" column="username" />
  10. <result property="password" column="password" />
  11. <result property="integral" column="integral" />
  12. <result property="delFlag" column="del_flag" />
  13. <result property="deptId" column="dept_id" />
  14. <result property="createBy" column="create_by" />
  15. <result property="createTime" column="create_time" />
  16. <result property="updateBy" column="update_by" />
  17. <result property="updateTime" column="update_time" />
  18. <result property="remark" column="remark" />
  19. <result property="nickName" column="nick_name" />
  20. <result property="customerNo" column="customer_no" />
  21. </resultMap>
  22. <sql id="selectTCustomerManageVo">
  23. SELECT
  24. a.id,
  25. a.NAME,
  26. a.username,
  27. a.PASSWORD,
  28. a.integral,
  29. a.del_flag,
  30. a.dept_id,
  31. a.create_by,
  32. a.create_time,
  33. a.update_by,
  34. a.update_time,
  35. a.remark,
  36. a.customer_no,
  37. a.nick_name
  38. FROM
  39. t_customer_manage a
  40. </sql>
  41. <select id="selectTCustomerManageList" parameterType="TCustomerManage" resultMap="TCustomerManageResult">
  42. <include refid="selectTCustomerManageVo"/>
  43. where a.del_flag = '0'
  44. <if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
  45. <if test="nickName != null and nickName != ''"> and a.nick_name like concat('%', #{nickName}, '%')</if>
  46. <if test="username != null and username != ''"> and a.username like concat('%', #{username}, '%')</if>
  47. <if test="password != null and password != ''"> and a.password = #{password}</if>
  48. <if test="integral != null "> and a.integral = #{integral}</if>
  49. <if test="deptId != null "> and a.dept_id = #{deptId}</if>
  50. <!-- 数据范围过滤 -->
  51. ${params.dataScope}
  52. </select>
  53. <select id="selectTCustomerManageList4H5" parameterType="TCustomerManage" resultMap="TCustomerManageResult">
  54. <include refid="selectTCustomerManageVo"/>
  55. where a.del_flag = '0'
  56. <if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
  57. <if test="nickName != null and nickName != ''"> and a.nick_name like concat('%', #{nickName}, '%')</if>
  58. <if test="username != null and username != ''"> and a.username like concat('%', #{username}, '%')</if>
  59. <if test="password != null and password != ''"> and a.password = #{password}</if>
  60. <if test="integral != null "> and a.integral = #{integral}</if>
  61. <if test="deptId != null "> and a.dept_id = #{deptId}</if>
  62. </select>
  63. <select id="selectTCustomerManageById" parameterType="Long" resultMap="TCustomerManageResult">
  64. <include refid="selectTCustomerManageVo"/>
  65. where a.id = #{id}
  66. </select>
  67. <insert id="insertTCustomerManage" parameterType="TCustomerManage" useGeneratedKeys="true" keyProperty="id">
  68. insert into t_customer_manage
  69. <trim prefix="(" suffix=")" suffixOverrides=",">
  70. <if test="name != null">name,</if>
  71. <if test="username != null">username,</if>
  72. <if test="password != null">password,</if>
  73. <if test="integral != null">integral,</if>
  74. <if test="delFlag != null">del_flag,</if>
  75. <if test="deptId != null">dept_id,</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="nickName != null">nick_name,</if>
  82. <if test="customerNo != null">customer_no,</if>
  83. </trim>
  84. <trim prefix="values (" suffix=")" suffixOverrides=",">
  85. <if test="name != null">#{name},</if>
  86. <if test="username != null">#{username},</if>
  87. <if test="password != null">#{password},</if>
  88. <if test="integral != null">#{integral},</if>
  89. <if test="delFlag != null">#{delFlag},</if>
  90. <if test="deptId != null">#{deptId},</if>
  91. <if test="createBy != null">#{createBy},</if>
  92. <if test="createTime != null">#{createTime},</if>
  93. <if test="updateBy != null">#{updateBy},</if>
  94. <if test="updateTime != null">#{updateTime},</if>
  95. <if test="remark != null">#{remark},</if>
  96. <if test="nickName != null">#{nickName},</if>
  97. <if test="customerNo != null">#{customerNo},</if>
  98. </trim>
  99. </insert>
  100. <update id="updateTCustomerManage" parameterType="TCustomerManage">
  101. update t_customer_manage
  102. <trim prefix="SET" suffixOverrides=",">
  103. <if test="name != null">name = #{name},</if>
  104. <if test="username != null">username = #{username},</if>
  105. <if test="password != null">password = #{password},</if>
  106. <if test="integral != null">integral = #{integral},</if>
  107. <if test="delFlag != null">del_flag = #{delFlag},</if>
  108. <if test="deptId != null">dept_id = #{deptId},</if>
  109. <if test="createBy != null">create_by = #{createBy},</if>
  110. <if test="createTime != null">create_time = #{createTime},</if>
  111. <if test="updateBy != null">update_by = #{updateBy},</if>
  112. <if test="updateTime != null">update_time = #{updateTime},</if>
  113. <if test="remark != null">remark = #{remark},</if>
  114. <if test="nickName != null">nick_name = #{nickName},</if>
  115. <if test="customerNo != null">customer_no = #{customerNo},</if>
  116. </trim>
  117. where id = #{id}
  118. </update>
  119. <delete id="deleteTCustomerManageById" parameterType="Long">
  120. delete from t_customer_manage where id = #{id}
  121. </delete>
  122. <delete id="deleteTCustomerManageByIds" parameterType="String">
  123. delete from t_customer_manage where id in
  124. <foreach item="id" collection="array" open="(" separator="," close=")">
  125. #{id}
  126. </foreach>
  127. </delete>
  128. <select id="selectTCustomerDistributionRecordList" parameterType="TCustomerManage" resultMap="TCustomerManageResult">
  129. SELECT
  130. a.id,
  131. a.NAME,
  132. a.username,
  133. a.PASSWORD,
  134. a.integral,
  135. a.del_flag,
  136. a.dept_id,
  137. a.create_by,
  138. a.create_time,
  139. a.update_by,
  140. a.update_time,
  141. a.remark,
  142. (select sum(b.distribution_integral) from t_customer_distribution_record b where a.id = b.customer_id GROUP BY b.customer_id) totalNum
  143. FROM
  144. t_customer_manage a
  145. where a.del_flag = '0'
  146. <if test="name != null and name != ''"> and a.name like concat('%', #{name}, '%')</if>
  147. <if test="username != null and username != ''"> and a.username like concat('%', #{username}, '%')</if>
  148. <if test="password != null and password != ''"> and a.password = #{password}</if>
  149. <if test="integral != null "> and a.integral = #{integral}</if>
  150. <if test="deptId != null "> and a.dept_id = #{deptId}</if>
  151. <!-- 数据范围过滤 -->
  152. ${params.dataScope}
  153. </select>
  154. <select id="selectLoginUser" parameterType="loginCustomerManage" resultType="loginCustomerManage">
  155. SELECT
  156. a.id,
  157. a.NAME,
  158. a.username,
  159. a.PASSWORD,
  160. a.integral,
  161. a.del_flag delFlag,
  162. a.dept_id deptId,
  163. a.create_by,
  164. a.create_time,
  165. a.update_by,
  166. a.update_time,
  167. a.remark,
  168. a.dept_id,
  169. a.nick_name nickName
  170. FROM
  171. t_customer_manage a
  172. where 1=1
  173. <if test="username != null">
  174. and a.username = #{username}
  175. </if>
  176. <if test="id != null">
  177. and a.username = #{username}
  178. </if>
  179. <if test="deptId != null">
  180. and a.dept_id = #{deptId}
  181. </if>
  182. <if test="deptId == null">
  183. and a.dept_id is null
  184. </if>
  185. </select>
  186. </mapper>