PrjGwtaskDao.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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.PrjGwtaskDao">
  4. <resultMap type="com.liang.entity.PrjGwtask" id="PrjGwtaskMap">
  5. <result property="id" column="ID" jdbcType="INTEGER"/>
  6. <result property="wjm" column="WJM" jdbcType="VARCHAR"/>
  7. <result property="scr" column="SCR" jdbcType="VARCHAR"/>
  8. <result property="scrq" column="SCRQ" jdbcType="TIMESTAMP"/>
  9. <result property="weburl" column="WebUrl" jdbcType="VARCHAR"/>
  10. <result property="bz" column="BZ" jdbcType="VARCHAR"/>
  11. </resultMap>
  12. <!--查询单个-->
  13. <select id="queryById" resultMap="PrjGwtaskMap">
  14. select *
  15. from prj_GwTask
  16. where ID = #{id}
  17. </select>
  18. <!--查询指定行数据-->
  19. <select id="queryAllByLimit" resultMap="PrjGwtaskMap">
  20. select *
  21. from prj_GwTask
  22. <where>
  23. <if test="id != null">
  24. and ID = #{id}
  25. </if>
  26. <if test="wjm != null and wjm != ''">
  27. and WJM = #{wjm}
  28. </if>
  29. <if test="scr != null and scr != ''">
  30. and SCR = #{scr}
  31. </if>
  32. <if test="scrq != null">
  33. and SCRQ = #{scrq}
  34. </if>
  35. <if test="weburl != null and weburl != ''">
  36. and WebUrl = #{weburl}
  37. </if>
  38. <if test="bz != null and bz != ''">
  39. and BZ = #{bz}
  40. </if>
  41. </where>
  42. limit #{pageable.offset}, #{pageable.pageSize}
  43. </select>
  44. <!--统计总行数-->
  45. <select id="count" resultType="java.lang.Long">
  46. select count(1)
  47. from prj_GwTask
  48. <where>
  49. <if test="id != null">
  50. and ID = #{id}
  51. </if>
  52. <if test="wjm != null and wjm != ''">
  53. and WJM = #{wjm}
  54. </if>
  55. <if test="scr != null and scr != ''">
  56. and SCR = #{scr}
  57. </if>
  58. <if test="scrq != null">
  59. and SCRQ = #{scrq}
  60. </if>
  61. <if test="weburl != null and weburl != ''">
  62. and WebUrl = #{weburl}
  63. </if>
  64. <if test="bz != null and bz != ''">
  65. and BZ = #{bz}
  66. </if>
  67. </where>
  68. </select>
  69. <!--新增所有列-->
  70. <insert id="insert" keyProperty="id" useGeneratedKeys="true">
  71. insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
  72. values (#{wjm}, #{scr}, GETDATE(), #{weburl}, #{bz})
  73. </insert>
  74. <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
  75. insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
  76. values
  77. <foreach collection="entities" item="entity" separator=",">
  78. (#{entity.wjm}, #{entity.scr}, #{entity.scrq}, #{entity.weburl}, #{entity.bz})
  79. </foreach>
  80. </insert>
  81. <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
  82. insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
  83. values
  84. <foreach collection="entities" item="entity" separator=",">
  85. (#{entity.wjm}, #{entity.scr}, #{entity.scrq}, #{entity.weburl}, #{entity.bz})
  86. </foreach>
  87. on duplicate key update
  88. WJM = values(WJM),
  89. SCR = values(SCR),
  90. SCRQ = values(SCRQ),
  91. WebUrl = values(WebUrl),
  92. BZ = values(BZ)
  93. </insert>
  94. <!--通过主键修改数据-->
  95. <update id="update">
  96. update prj_GwTask
  97. <set>
  98. <if test="wjm != null and wjm != ''">
  99. WJM = #{wjm},
  100. </if>
  101. <if test="scr != null and scr != ''">
  102. SCR = #{scr},
  103. </if>
  104. <if test="scrq != null">
  105. SCRQ = #{scrq},
  106. </if>
  107. <if test="weburl != null and weburl != ''">
  108. WebUrl = #{weburl},
  109. </if>
  110. <if test="bz != null and bz != ''">
  111. BZ = #{bz},
  112. </if>
  113. </set>
  114. where ID = #{id}
  115. </update>
  116. <!--通过主键删除-->
  117. <delete id="deleteById">
  118. delete
  119. from prj_GwTask
  120. where ID = #{id}
  121. </delete>
  122. <!--国网任务书列表-->
  123. <select id="getGwTaslList" resultMap="PrjGwtaskMap" parameterType="map">
  124. select *
  125. from prj_GwTask p
  126. <if test="scr != null and scr != ''">
  127. where p.SCR = #{scr}
  128. </if>
  129. <choose>
  130. <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
  131. order by ${sortName} ${sortOrder}
  132. </when>
  133. <otherwise>
  134. order by ID desc
  135. </otherwise>
  136. </choose>
  137. </select>
  138. </mapper>