DicConsulationUserMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.xinxin.topro.sysservice.dao.mysqlmapper.DicConsulationUserMapper" >
  4. <resultMap id="BaseResultMap" type="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  5. <id column="DCU_ID" property="dcuId" jdbcType="INTEGER" />
  6. <result column="DCT_ID" property="dctId" jdbcType="INTEGER" />
  7. <result column="DCU_User" property="dcuUser" jdbcType="VARCHAR" />
  8. <result column="DCU_Recordor" property="dcuRecordor" jdbcType="VARCHAR" />
  9. <result column="DCU_Record_Time" property="dcuRecordTime" jdbcType="TIMESTAMP" />
  10. <result column="DCU_IsDel" property="dcuIsdel" jdbcType="INTEGER" />
  11. </resultMap>
  12. <resultMap id="ListRequestMap" extends="BaseResultMap" type="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUserVO">
  13. <result column="UI_Name" property="userName" jdbcType="VARCHAR" />
  14. <result column="UI_Name" property="recordorName" jdbcType="VARCHAR" />
  15. <result column="SS_Type" property="ssType" jdbcType="INTEGER" />
  16. </resultMap>
  17. <sql id="Base_Column_List" >
  18. DCU_ID, DCT_ID, DCU_User, DCU_Recordor, DCU_Record_Time, DCU_IsDel
  19. </sql>
  20. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  21. select
  22. <include refid="Base_Column_List" />
  23. from dic_consulation_user
  24. where DCU_ID = #{dcuId,jdbcType=INTEGER}
  25. </select>
  26. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  27. delete from dic_consulation_user
  28. where DCU_ID = #{dcuId,jdbcType=INTEGER}
  29. </delete>
  30. <delete id="deleteByDctId" parameterType="java.lang.Integer" >
  31. update dic_consulation_user set DCU_IsDel = -1
  32. where DCT_ID = #{dctId,jdbcType=INTEGER}
  33. </delete>
  34. <insert id="insert" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  35. insert into dic_consulation_user (DCU_ID, DCT_ID, DCU_User,
  36. DCU_Recordor, DCU_Record_Time, DCU_IsDel
  37. )
  38. values (#{dcuId,jdbcType=INTEGER}, #{dctId,jdbcType=INTEGER}, #{dcuUser,jdbcType=VARCHAR},
  39. #{dcuRecordor,jdbcType=VARCHAR}, #{dcuRecordTime,jdbcType=TIMESTAMP}, #{dcuIsdel,jdbcType=INTEGER}
  40. )
  41. </insert>
  42. <insert id="insertSelective" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  43. insert into dic_consulation_user
  44. <trim prefix="(" suffix=")" suffixOverrides="," >
  45. <if test="dcuId != null" >
  46. DCU_ID,
  47. </if>
  48. <if test="dctId != null" >
  49. DCT_ID,
  50. </if>
  51. <if test="dcuUser != null" >
  52. DCU_User,
  53. </if>
  54. <if test="dcuRecordor != null" >
  55. DCU_Recordor,
  56. </if>
  57. <if test="dcuRecordTime != null" >
  58. DCU_Record_Time,
  59. </if>
  60. <if test="dcuIsdel != null" >
  61. DCU_IsDel,
  62. </if>
  63. </trim>
  64. <trim prefix="values (" suffix=")" suffixOverrides="," >
  65. <if test="dcuId != null" >
  66. #{dcuId,jdbcType=INTEGER},
  67. </if>
  68. <if test="dctId != null" >
  69. #{dctId,jdbcType=INTEGER},
  70. </if>
  71. <if test="dcuUser != null" >
  72. #{dcuUser,jdbcType=VARCHAR},
  73. </if>
  74. <if test="dcuRecordor != null" >
  75. #{dcuRecordor,jdbcType=VARCHAR},
  76. </if>
  77. <if test="dcuRecordTime != null" >
  78. #{dcuRecordTime,jdbcType=TIMESTAMP},
  79. </if>
  80. <if test="dcuIsdel != null" >
  81. #{dcuIsdel,jdbcType=INTEGER},
  82. </if>
  83. </trim>
  84. </insert>
  85. <update id="updateByPrimaryKeySelective" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  86. update dic_consulation_user
  87. <set >
  88. <if test="dctId != null" >
  89. DCT_ID = #{dctId,jdbcType=INTEGER},
  90. </if>
  91. <if test="dcuUser != null" >
  92. DCU_User = #{dcuUser,jdbcType=VARCHAR},
  93. </if>
  94. <if test="dcuRecordor != null" >
  95. DCU_Recordor = #{dcuRecordor,jdbcType=VARCHAR},
  96. </if>
  97. <if test="dcuRecordTime != null" >
  98. DCU_Record_Time = #{dcuRecordTime,jdbcType=TIMESTAMP},
  99. </if>
  100. <if test="dcuIsdel != null" >
  101. DCU_IsDel = #{dcuIsdel,jdbcType=INTEGER},
  102. </if>
  103. </set>
  104. where DCU_ID = #{dcuId,jdbcType=INTEGER}
  105. </update>
  106. <update id="updateByPrimaryKey" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  107. update dic_consulation_user
  108. set DCT_ID = #{dctId,jdbcType=INTEGER},
  109. DCU_User = #{dcuUser,jdbcType=VARCHAR},
  110. DCU_Recordor = #{dcuRecordor,jdbcType=VARCHAR},
  111. DCU_Record_Time = #{dcuRecordTime,jdbcType=TIMESTAMP},
  112. DCU_IsDel = #{dcuIsdel,jdbcType=INTEGER}
  113. where DCU_ID = #{dcuId,jdbcType=INTEGER}
  114. </update>
  115. <update id="delDicConsulationUser" parameterType="java.lang.Integer" >
  116. update dic_consulation_user
  117. set DCU_IsDel = -1
  118. where DCU_ID = #{dcuId,jdbcType=INTEGER}
  119. </update>
  120. <select id="getDicConsulationUserByDctId" parameterType="java.lang.Integer" resultMap="ListRequestMap">
  121. select
  122. <include refid="Base_Column_List" />,
  123. b.UI_Name userName,
  124. b.SS_Type ssType,
  125. c.UI_Name recordorName
  126. from dic_consulation_user a
  127. left join sys_userinfo b on a.DCU_User = b.UI_Code
  128. left join sys_userinfo c on a.DCU_Recordor = c.UI_Code
  129. where DCT_ID= #{dctId,jdbcType=INTEGER} and DCU_IsDel = 0
  130. </select>
  131. <insert id="insertList" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser" >
  132. insert into dic_consulation_user (DCT_ID, DCU_User,
  133. DCU_Recordor, DCU_Record_Time, DCU_IsDel)
  134. values
  135. <foreach collection="list" separator="," item="item">
  136. (#{item.dctId,jdbcType=INTEGER}, #{item.dcuUser,jdbcType=VARCHAR},
  137. #{item.dcuRecordor,jdbcType=VARCHAR}, now(), #{item.dcuIsdel,jdbcType=INTEGER})
  138. </foreach>
  139. </insert>
  140. <update id="updateList" parameterType="com.xinxin.topro.sysservice.dao.mysqlmodel.DicConsulationUser">
  141. <foreach item='item' index='index' collection='list' open='' separator=';' close=''>
  142. update dic_consulation_user
  143. set DCT_ID=#{item.dctId,jdbcType=INTEGER},
  144. DCU_User= #{item.dcuUser,jdbcType=VARCHAR},
  145. DCU_Recordor= #{item.dcuRecordor,jdbcType=VARCHAR},
  146. DCU_Record_Time=now()
  147. where DCU_ID = #{item.dcuId,jdbcType=INTEGER}
  148. </foreach>
  149. </update>
  150. <select id="selectByDctId" resultType="com.xinxin.topro.sysservice.response.ConsultationUserResponse" parameterType="java.lang.Integer">
  151. SELECT
  152. dcu.DCU_ID AS dcuId,
  153. su.UI_Code AS uiCode,
  154. su.UI_Name AS uiName,
  155. dd.DD_DepName AS depName
  156. FROM
  157. dic_consulation_user dcu
  158. LEFT JOIN sys_userinfo su ON dcu.DCU_User = su.UI_Code
  159. LEFT JOIN dic_department dd ON su.SS_DepartmentID = dd.DD_ID
  160. WHERE
  161. dcu.DCT_ID = #{dctId,jdbcType=INTEGER}
  162. AND DCU_IsDel = 0
  163. </select>
  164. <update id="deleteTeamUser">
  165. UPDATE dic_consulation_user
  166. SET DCU_IsDel = -1
  167. WHERE DCT_ID = #{dctId,jdbcType=INTEGER}
  168. </update>
  169. </mapper>