BisInspMtprgSmsDao.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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="cn.com.goldenwater.dcproj.dao.BisInspMtprgSmsDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspMtprgSms" id="bisInspMtprgSmsResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="userId" column="USER_ID"/>
  7. <result property="userName" column="USER_NAME"/>
  8. <result property="phone" column="PHONE"/>
  9. <result property="isRemind" column="IS_REMIND"/>
  10. <result property="intm" column="INTM"/>
  11. <result property="uptm" column="UPTM"/>
  12. <result property="createrId" column="CREATER_ID"/>
  13. <result property="orgId" column="ORG_ID"/>
  14. </resultMap>
  15. <sql id="table_columns">
  16. ID,
  17. USER_ID,
  18. USER_NAME,
  19. PHONE,
  20. IS_REMIND,
  21. INTM,
  22. UPTM,
  23. ORG_ID,
  24. CREATER_ID
  25. </sql>
  26. <sql id="table_columns2">
  27. S.ID,
  28. S.USER_ID,
  29. S.USER_NAME,
  30. S.IS_REMIND,
  31. S.INTM,
  32. S.UPTM,
  33. S.CREATER_ID,
  34. P.CALLNUMBER,
  35. P.PROVINCE,
  36. P.DEPART_ID,
  37. P.DEPART_NM,
  38. P.DPNM,
  39. P.DPPOST,
  40. P.IDNM,
  41. P.PLST,
  42. P.SCHOOL,
  43. P.SPECIALTY,
  44. P.IMGURL,
  45. P.GUID,
  46. P.PERS_NAME,
  47. P.PWD,
  48. P.SEX,
  49. P.TELNUMB,
  50. P.FAXNUMB,
  51. P.MOBILENUMB,
  52. P.EMAIL,
  53. P.BORN_DATE,
  54. P.ORG_ID,
  55. P.ORG_NM,
  56. P.ADM_DUTY,
  57. P.COLL_TIME,
  58. P.REMARK,
  59. P.PERS_TYPE,
  60. P.PERMISSION,
  61. P.OWNER_SYSTEM,
  62. P.W_UNIT,
  63. O.ORG_NM AS ORG_NAME
  64. </sql>
  65. <sql id="entity_properties">
  66. #{id},
  67. #{userId},
  68. #{userName},
  69. #{phone},
  70. #{isRemind},
  71. #{intm},
  72. #{uptm},
  73. #{orgId},
  74. #{createrId}
  75. </sql>
  76. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  77. <sql id="page_where">
  78. <trim prefix="where" prefixOverrides="and | or ">
  79. <if test="userId != null and userId != ''">and USER_ID = #{userId}</if>
  80. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  81. <if test="userName != null and userName != ''">and USER_NAME = #{userName}</if>
  82. <if test="phone != null and phone != ''">and PHONE = #{phone}</if>
  83. <if test="isRemind != null and isRemind != ''">and IS_REMIND = #{isRemind}</if>
  84. <if test="intm != null">and INTM = #{intm}</if>
  85. <if test="createrId != null and createrId != ''">and CREATER_ID = #{createrId}</if>
  86. </trim>
  87. </sql>
  88. <select id="get" resultMap="bisInspMtprgSmsResultMap" parameterType="String">
  89. select
  90. <include refid="table_columns"/>
  91. from BIS_INSP_MTPRG_SMS where ID = #{id}
  92. </select>
  93. <select id="getBy" resultMap="bisInspMtprgSmsResultMap">
  94. select
  95. <include refid="table_columns"/>
  96. from BIS_INSP_MTPRG_SMS
  97. <include refid="page_where"/>
  98. </select>
  99. <select id="findAll" resultMap="bisInspMtprgSmsResultMap">
  100. select
  101. <include refid="table_columns"/>
  102. from BIS_INSP_MTPRG_SMS
  103. </select>
  104. <select id="findList" resultMap="bisInspMtprgSmsResultMap">
  105. select
  106. <include refid="table_columns"/>
  107. from BIS_INSP_MTPRG_SMS
  108. <include refid="page_where"/>
  109. </select>
  110. <select id="selectCount" resultType="int">
  111. select count(ID) from BIS_INSP_MTPRG_SMS
  112. <include refid="page_where"/>
  113. </select>
  114. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprgSms">
  115. insert into BIS_INSP_MTPRG_SMS(
  116. <include refid="table_columns"/>
  117. )
  118. values (
  119. <include refid="entity_properties"/>
  120. )
  121. </insert>
  122. <delete id="delete" parameterType="java.lang.String">
  123. delete from BIS_INSP_MTPRG_SMS where ID = #{id}
  124. </delete>
  125. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprgSms">
  126. update BIS_INSP_MTPRG_SMS set DATA_STAT='9'
  127. <include refid="page_where"/>
  128. </delete>
  129. <update id="deleteInFlag" parameterType="java.lang.String">
  130. update BIS_INSP_MTPRG_SMS set DATA_STAT = '9' where ID = #{id}
  131. </update>
  132. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprgSms">
  133. update BIS_INSP_MTPRG_SMS
  134. <trim prefix="set" suffixOverrides=",">
  135. <if test="userId != null and userId != ''">USER_ID = #{userId},</if>
  136. <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
  137. <if test="phone != null and phone != ''">PHONE = #{phone},</if>
  138. <if test="isRemind != null and isRemind != ''">IS_REMIND = #{isRemind},</if>
  139. <if test="intm != null">INTM = #{intm},</if>
  140. <if test="uptm != null">UPTM = #{uptm},</if>
  141. <if test="createrId != null and createrId != ''">CREATER_ID = #{createrId},</if>
  142. </trim>
  143. <where>ID = #{id}</where>
  144. </update>
  145. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspMtprgSms">
  146. update BIS_INSP_MTPRG_SMS
  147. <trim prefix="set" suffixOverrides=",">
  148. <if test="userId != null and userId != ''">USER_ID = #{userId},</if>
  149. <if test="userName != null and userName != ''">USER_NAME = #{userName},</if>
  150. <if test="phone != null and phone != ''">PHONE = #{phone},</if>
  151. <if test="isRemind != null and isRemind != ''">IS_REMIND = #{isRemind},</if>
  152. <if test="intm != null">INTM = #{intm},</if>
  153. <if test="uptm != null">UPTM = #{uptm},</if>
  154. <if test="createrId != null and createrId != ''">CREATER_ID = #{createrId},</if>
  155. </trim>
  156. <include refid="page_where"/>
  157. </update>
  158. <!-- 其他自定义SQL -->
  159. <select id="listByNotMonthReport" resultType="cn.com.goldenwater.dcproj.model.BisInspAllRlationPers">
  160. select distinct P.*
  161. from BIS_INSP_ALL_RLATION_PERS P
  162. JOIN (
  163. SELECT *
  164. FROM BIS_INSP_PERS_ORG G
  165. WHERE ORG_ID = #{orgId}
  166. ) G ON P.GUID=G.PERS_ID
  167. <where>
  168. P.GUID NOT IN (SELECT USER_ID FROM BIS_INSP_MTPRG_SMS where ORG_ID = #{orgId})
  169. <if test="dpnm != null and dpnm != ''">AND P.DPNM like CONCAT('%', CONCAT(#{dpnm}, '%'))</if>
  170. <if test="userName != null and userName != ''">and P.PERS_NAME LIKE CONCAT('%', CONCAT(#{userName},'%'))
  171. </if>
  172. <if test="name != null and name != ''">and P.PERS_NAME LIKE CONCAT('%', CONCAT(#{name},'%'))</if>
  173. <if test="phone != null and phone != ''">and P.MOBILENUMB LIKE CONCAT('%', CONCAT(#{phone},'%'))</if>
  174. </where>
  175. </select>
  176. <!-- 其他自定义SQL -->
  177. <select id="list" resultType="cn.com.goldenwater.dcproj.vo.BisInspMtprgSmsVo">
  178. select
  179. <include refid="table_columns2"/>
  180. from BIS_INSP_MTPRG_SMS S
  181. JOIN BIS_INSP_ALL_RLATION_PERS P ON S.USER_ID = P.GUID
  182. LEFT JOIN BIS_INSP_ORG O ON O.ORG_ID = P.ORG_ID
  183. <where>
  184. S.USER_ID IN ( SELECT PERS_ID FROM BIS_INSP_PERS_ORG
  185. <if test="orgId != null and orgId != ''">WHERE ORG_ID = #{orgId}</if>
  186. )
  187. <if test="orgId != null and orgId != ''">AND S.ORG_ID = #{orgId}</if>
  188. <if test="dpnm != null and dpnm != ''">AND P.DPNM like CONCAT('%', CONCAT(#{dpnm}, '%'))</if>
  189. <if test="userName != null and userName != ''">and S.USER_NAME like CONCAT('%', CONCAT(#{userName}, '%'))
  190. </if>
  191. <if test="name != null and name != ''">and S.USER_NAME LIKE CONCAT('%', CONCAT(#{name},'%'))</if>
  192. <if test="phone != null and phone != ''">and S.PHONE LIKE CONCAT('%', CONCAT(#{phone},'%'))</if>
  193. <if test="isRemind != null and isRemind != ''">and S.IS_REMIND = #{isRemind}</if>
  194. <if test="createrId != null and createrId != ''">and S.CREATER_ID = #{createrId}</if>
  195. </where>
  196. </select>
  197. </mapper>