ViewApproveRecordDao.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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.liang.dao.ViewApproveRecordDao">
  4. <resultMap type="com.liang.entity.ViewApproveRecord" id="ViewApproveRecordMap">
  5. <result property="tablename" column="TABLENAME" jdbcType="VARCHAR"/>
  6. <result property="xmid" column="XMID" jdbcType="INTEGER"/>
  7. <result property="xm" column="XM" jdbcType="VARCHAR"/>
  8. <result property="zt" column="ZT" jdbcType="VARCHAR"/>
  9. <result property="wc" column="WC" jdbcType="VARCHAR"/>
  10. <result property="tjsj" column="TJSJ" jdbcType="TIMESTAMP"/>
  11. <result property="shsj" column="SHSJ" jdbcType="TIMESTAMP"/>
  12. <result property="tjr" column="TJR" jdbcType="INTEGER"/>
  13. <result property="shr" column="SHR" jdbcType="INTEGER"/>
  14. <result property="tjrname" column="TJRNAME" jdbcType="VARCHAR"/>
  15. <result property="t" column="T" jdbcType="VARCHAR"/>
  16. <result property="shrname" column="SHRNAME" jdbcType="VARCHAR"/>
  17. <result property="shrdw" column="SHRDW" jdbcType="VARCHAR"/>
  18. </resultMap>
  19. <!--查询单个-->
  20. <select id="queryById" resultMap="ViewApproveRecordMap">
  21. select
  22. TABLENAME, XMID, XM, ZT, WC, TJSJ, SHSJ, TJR, SHR, TJRNAME, T, SHRNAME, SHRDW
  23. from view_approve_record
  24. where = #{id}
  25. </select>
  26. <!--查询指定行数据-->
  27. <select id="queryAllByLimit" resultMap="ViewApproveRecordMap">
  28. select
  29. TABLENAME, XMID, XM, ZT, WC, TJSJ, SHSJ, TJR, SHR, TJRNAME, T, SHRNAME, SHRDW
  30. from view_approve_record
  31. <where>
  32. <if test="tablename != null and tablename != ''">
  33. and TABLENAME = #{tablename}
  34. </if>
  35. <if test="xmid != null">
  36. and XMID = #{xmid}
  37. </if>
  38. <if test="xm != null and xm != ''">
  39. and XM = #{xm}
  40. </if>
  41. <if test="zt != null and zt != ''">
  42. and ZT = #{zt}
  43. </if>
  44. <if test="wc != null and wc != ''">
  45. and WC = #{wc}
  46. </if>
  47. <if test="tjsj != null">
  48. and TJSJ = #{tjsj}
  49. </if>
  50. <if test="shsj != null">
  51. and SHSJ = #{shsj}
  52. </if>
  53. <if test="tjr != null">
  54. and TJR = #{tjr}
  55. </if>
  56. <if test="shr != null">
  57. and SHR = #{shr}
  58. </if>
  59. <if test="tjrname != null and tjrname != ''">
  60. and TJRNAME = #{tjrname}
  61. </if>
  62. <if test="t != null and t != ''">
  63. and T = #{t}
  64. </if>
  65. <if test="shrname != null and shrname != ''">
  66. and SHRNAME = #{shrname}
  67. </if>
  68. <if test="shrdw != null and shrdw != ''">
  69. and SHRDW = #{shrdw}
  70. </if>
  71. </where>
  72. limit #{pageable.offset}, #{pageable.pageSize}
  73. </select>
  74. <!--统计总行数-->
  75. <select id="count" resultType="java.lang.Long">
  76. select count(1)
  77. from view_approve_record
  78. <where>
  79. <if test="tablename != null and tablename != ''">
  80. and TABLENAME = #{tablename}
  81. </if>
  82. <if test="xmid != null">
  83. and XMID = #{xmid}
  84. </if>
  85. <if test="xm != null and xm != ''">
  86. and XM = #{xm}
  87. </if>
  88. <if test="zt != null and zt != ''">
  89. and ZT = #{zt}
  90. </if>
  91. <if test="wc != null and wc != ''">
  92. and WC = #{wc}
  93. </if>
  94. <if test="tjsj != null">
  95. and TJSJ = #{tjsj}
  96. </if>
  97. <if test="shsj != null">
  98. and SHSJ = #{shsj}
  99. </if>
  100. <if test="tjr != null">
  101. and TJR = #{tjr}
  102. </if>
  103. <if test="shr != null">
  104. and SHR = #{shr}
  105. </if>
  106. <if test="tjrname != null and tjrname != ''">
  107. and TJRNAME = #{tjrname}
  108. </if>
  109. <if test="t != null and t != ''">
  110. and T = #{t}
  111. </if>
  112. <if test="shrname != null and shrname != ''">
  113. and SHRNAME = #{shrname}
  114. </if>
  115. <if test="shrdw != null and shrdw != ''">
  116. and SHRDW = #{shrdw}
  117. </if>
  118. </where>
  119. </select>
  120. <!--新增所有列-->
  121. <insert id="insert" keyProperty="" useGeneratedKeys="true">
  122. insert into view_approve_record(TABLENAME, XMID, XM, ZT, WC, TJSJ, SHSJ, TJR, SHR, TJRNAME, T, SHRNAME, SHRDW)
  123. values (#{tablename}, #{xmid}, #{xm}, #{zt}, #{wc}, #{tjsj}, #{shsj}, #{tjr}, #{shr}, #{tjrname}, #{t}, #{shrname}, #{shrdw})
  124. </insert>
  125. <insert id="insertBatch" keyProperty="" useGeneratedKeys="true">
  126. insert into view_approve_record(TABLENAME, XMID, XM, ZT, WC, TJSJ, SHSJ, TJR, SHR, TJRNAME, T, SHRNAME, SHRDW)
  127. values
  128. <foreach collection="entities" item="entity" separator=",">
  129. (#{entity.tablename}, #{entity.xmid}, #{entity.xm}, #{entity.zt}, #{entity.wc}, #{entity.tjsj}, #{entity.shsj}, #{entity.tjr}, #{entity.shr}, #{entity.tjrname}, #{entity.t}, #{entity.shrname}, #{entity.shrdw})
  130. </foreach>
  131. </insert>
  132. <insert id="insertOrUpdateBatch" keyProperty="" useGeneratedKeys="true">
  133. insert into view_approve_record(TABLENAME, XMID, XM, ZT, WC, TJSJ, SHSJ, TJR, SHR, TJRNAME, T, SHRNAME, SHRDW)
  134. values
  135. <foreach collection="entities" item="entity" separator=",">
  136. (#{entity.tablename}, #{entity.xmid}, #{entity.xm}, #{entity.zt}, #{entity.wc}, #{entity.tjsj}, #{entity.shsj}, #{entity.tjr}, #{entity.shr}, #{entity.tjrname}, #{entity.t}, #{entity.shrname}, #{entity.shrdw})
  137. </foreach>
  138. on duplicate key update
  139. TABLENAME = values(TABLENAME),
  140. XMID = values(XMID),
  141. XM = values(XM),
  142. ZT = values(ZT),
  143. WC = values(WC),
  144. TJSJ = values(TJSJ),
  145. SHSJ = values(SHSJ),
  146. TJR = values(TJR),
  147. SHR = values(SHR),
  148. TJRNAME = values(TJRNAME),
  149. T = values(T),
  150. SHRNAME = values(SHRNAME),
  151. SHRDW = values(SHRDW)
  152. </insert>
  153. <!--通过主键修改数据-->
  154. <update id="update">
  155. update view_approve_record
  156. <set>
  157. <if test="tablename != null and tablename != ''">
  158. TABLENAME = #{tablename},
  159. </if>
  160. <if test="xmid != null">
  161. XMID = #{xmid},
  162. </if>
  163. <if test="xm != null and xm != ''">
  164. XM = #{xm},
  165. </if>
  166. <if test="zt != null and zt != ''">
  167. ZT = #{zt},
  168. </if>
  169. <if test="wc != null and wc != ''">
  170. WC = #{wc},
  171. </if>
  172. <if test="tjsj != null">
  173. TJSJ = #{tjsj},
  174. </if>
  175. <if test="shsj != null">
  176. SHSJ = #{shsj},
  177. </if>
  178. <if test="tjr != null">
  179. TJR = #{tjr},
  180. </if>
  181. <if test="shr != null">
  182. SHR = #{shr},
  183. </if>
  184. <if test="tjrname != null and tjrname != ''">
  185. TJRNAME = #{tjrname},
  186. </if>
  187. <if test="t != null and t != ''">
  188. T = #{t},
  189. </if>
  190. <if test="shrname != null and shrname != ''">
  191. SHRNAME = #{shrname},
  192. </if>
  193. <if test="shrdw != null and shrdw != ''">
  194. SHRDW = #{shrdw},
  195. </if>
  196. </set>
  197. where = #{}
  198. </update>
  199. <!--通过主键删除-->
  200. <delete id="deleteById">
  201. delete from view_approve_record where = #{id}
  202. </delete>
  203. <!--查询单个-->
  204. <select id="getApproveRecordList" resultMap="ViewApproveRecordMap">
  205. SELECT prj_ApproveRecord.ID, prj_ApproveRecord.TABLENAME, prj_ApproveRecord.XMID, prj_ApproveRecord.XM, prj_ApproveRecord.ZT, prj_ApproveRecord.WC, prj_ApproveRecord.TJSJ, prj_ApproveRecord.SHSJ,
  206. prj_ApproveRecord.TJR, prj_ApproveRecord.SHR, base_Person.XM AS TJRNAME, base_Company.MC AS TJRDW, sys_user_info.name as SHRNAME, sys_dept_info.dept_name as SHRDW
  207. FROM sys_dept_info RIGHT OUTER JOIN
  208. sys_user_info ON sys_dept_info.dept_id = sys_user_info.dept_id RIGHT OUTER JOIN
  209. prj_ApproveRecord LEFT OUTER JOIN
  210. base_Person base_Person LEFT OUTER JOIN
  211. base_Company base_Company ON base_Person.DW = base_Company.ID ON prj_ApproveRecord.TJR = base_Person.ID ON sys_user_info.user_id = prj_ApproveRecord.SHR
  212. where WC = 0 order by xmid asc,tjsj asc
  213. </select>
  214. </mapper>