BmProjectMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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.system.mapper.project.BmProjectMapper">
  6. <resultMap type="BmProject" id="BmProjectResult">
  7. <result property="id" column="id" />
  8. <result property="createBy" column="create_by" />
  9. <result property="createTime" column="create_time" />
  10. <result property="updateBy" column="update_by" />
  11. <result property="updateTime" column="update_time" />
  12. <result property="name" column="name" />
  13. <result property="industryCategory" column="industry_category" />
  14. <result property="industry" column="industry" />
  15. <result property="isBackbussiness" column="is_backbussiness" />
  16. <result property="projectStatus" column="project_status" />
  17. <result property="deptId" column="dept_id" />
  18. <result property="totAmt" column="tot_amt" />
  19. <result property="isDel" column="is_del" />
  20. <result property="orderBeginTime" column="order_begin_time" />
  21. <result property="orderEndTime" column="order_end_time" />
  22. <result property="remark" column="remark" />
  23. <result property="deptName" column="dept_name" />
  24. <result property="dictLabel" column="dict_label" />
  25. </resultMap>
  26. <sql id="selectBmProjectVo">
  27. select id, create_by, create_time, update_by, update_time, name, industry_category, industry, is_backbussiness, project_status, dept_id, tot_amt, is_del, order_begin_time, order_end_time, remark from bm_project
  28. </sql>
  29. <select id="selectBmProjectList" parameterType="BmProject" resultMap="BmProjectResult">
  30. SELECT
  31. p.id,
  32. p.create_by,
  33. p.create_time,
  34. p.update_by,
  35. p.update_time,
  36. p.NAME,
  37. p.industry_category,
  38. p.industry,
  39. p.is_backbussiness,
  40. p.project_status,
  41. p.dept_id,
  42. p.tot_amt,
  43. p.is_del,
  44. p.order_begin_time,
  45. p.order_end_time,
  46. p.remark ,
  47. d.dept_name,
  48. sdd.dict_label
  49. FROM
  50. bm_project p
  51. left join sys_dept d on p.dept_id = d.dept_id and p.is_del = '0'
  52. left join sys_dict_data sdd on p.project_status = sdd.dict_value and sdd.dict_type = 'project_status'
  53. <where>
  54. <if test="sysDeptId != null">and p.dept_id = #{sysDeptId}</if>
  55. <if test="name != null and name != ''"> and p.name like concat('%', #{name}, '%')</if>
  56. <if test="industryCategory != null and industryCategory != ''"> and p.industry_category = #{industryCategory}</if>
  57. <if test="industry != null and industry != ''"> and p.industry = #{industry}</if>
  58. <if test="projectStatus != null "> and p.project_status = #{projectStatus}</if>
  59. <if test="deptName != null and deptName != ''"> and d.dept_name = #{deptName}</if>
  60. <if test="totAmt != null "> and p.tot_amt = #{totAmt}</if>
  61. <if test="isDel != null "> and p.is_del = #{isDel}</if>
  62. <if test="beginTime != null "> and p.create_time &gt;= #{beginTime}</if>
  63. <if test="endTime != null "> and p.create_time &lt;= #{endTime}</if>
  64. </where>
  65. order by p.create_time DESC
  66. </select>
  67. <select id="selectToBeReviewedList" parameterType="BmProject" resultMap="BmProjectResult">
  68. SELECT
  69. p.id,
  70. p.create_by,
  71. p.create_time,
  72. p.update_by,
  73. p.update_time,
  74. p.NAME,
  75. p.industry_category,
  76. p.industry,
  77. p.is_backbussiness,
  78. p.project_status,
  79. p.dept_id,
  80. p.tot_amt,
  81. p.is_del,
  82. p.order_begin_time,
  83. p.order_end_time,
  84. p.remark ,
  85. sdd.dict_label
  86. FROM
  87. bm_project p
  88. left join sys_dict_data sdd on p.project_status = sdd.dict_value and sdd.dict_type = 'project_status'
  89. <where>
  90. p.is_del = '0' and
  91. sdd.dict_value=(sdd.dict_value<![CDATA[>>]]>1)<![CDATA[<<]]>1
  92. <if test="deptId != null"> and p.dept_id = #{deptId}</if>
  93. </where>
  94. order by p.create_time DESC
  95. </select>
  96. <select id="selectBmProjectById" parameterType="Long" resultMap="BmProjectResult">
  97. SELECT
  98. p.id,
  99. p.create_by,
  100. p.create_time,
  101. p.update_by,
  102. p.update_time,
  103. p.NAME,
  104. p.industry_category,
  105. p.industry,
  106. p.is_backbussiness,
  107. p.project_status,
  108. p.dept_id,
  109. p.tot_amt,
  110. p.is_del,
  111. p.order_begin_time,
  112. p.order_end_time,
  113. p.remark ,
  114. d.dept_name,
  115. sdd.dict_label
  116. FROM
  117. bm_project p
  118. left join sys_dept d on p.dept_id = d.dept_id
  119. left join sys_dict_data sdd on p.project_status = sdd.dict_value and sdd.dict_type = 'project_status'
  120. where p.id = #{id} and p.is_del = '0'
  121. </select>
  122. <insert id="insertBmProject" parameterType="BmProject" useGeneratedKeys="true" keyProperty="id">
  123. insert into bm_project
  124. <trim prefix="(" suffix=")" suffixOverrides=",">
  125. <if test="createBy != null">create_by,</if>
  126. <if test="createTime != null">create_time,</if>
  127. <if test="updateBy != null">update_by,</if>
  128. <if test="updateTime != null">update_time,</if>
  129. <if test="name != null">name,</if>
  130. <if test="industryCategory != null">industry_category,</if>
  131. <if test="industry != null">industry,</if>
  132. <if test="isBackbussiness != null">is_backbussiness,</if>
  133. <if test="projectStatus != null">project_status,</if>
  134. <if test="deptId != null">dept_id,</if>
  135. <if test="totAmt != null">tot_amt,</if>
  136. <if test="isDel != null">is_del,</if>
  137. <if test="orderBeginTime != null">order_begin_time,</if>
  138. <if test="orderEndTime != null">order_end_time,</if>
  139. <if test="remark != null">remark,</if>
  140. </trim>
  141. <trim prefix="values (" suffix=")" suffixOverrides=",">
  142. <if test="createBy != null">#{createBy},</if>
  143. <if test="createTime != null">#{createTime},</if>
  144. <if test="updateBy != null">#{updateBy},</if>
  145. <if test="updateTime != null">#{updateTime},</if>
  146. <if test="name != null">#{name},</if>
  147. <if test="industryCategory != null">#{industryCategory},</if>
  148. <if test="industry != null">#{industry},</if>
  149. <if test="isBackbussiness != null">#{isBackbussiness},</if>
  150. <if test="projectStatus != null">#{projectStatus},</if>
  151. <if test="deptId != null">#{deptId},</if>
  152. <if test="totAmt != null">#{totAmt},</if>
  153. <if test="isDel != null">#{isDel},</if>
  154. <if test="orderBeginTime != null">#{orderBeginTime},</if>
  155. <if test="orderEndTime != null">#{orderEndTime},</if>
  156. <if test="remark != null">#{remark},</if>
  157. </trim>
  158. </insert>
  159. <update id="updateBmProject" parameterType="BmProject">
  160. update bm_project
  161. <trim prefix="SET" suffixOverrides=",">
  162. <if test="createBy != null">create_by = #{createBy},</if>
  163. <if test="createTime != null">create_time = #{createTime},</if>
  164. <if test="updateBy != null">update_by = #{updateBy},</if>
  165. <if test="updateTime != null">update_time = #{updateTime},</if>
  166. <if test="name != null">name = #{name},</if>
  167. <if test="industryCategory != null">industry_category = #{industryCategory},</if>
  168. <if test="industry != null">industry = #{industry},</if>
  169. <if test="isBackbussiness != null">is_backbussiness = #{isBackbussiness},</if>
  170. <if test="projectStatus != null">project_status = #{projectStatus},</if>
  171. <if test="deptId != null">dept_id = #{deptId},</if>
  172. <if test="totAmt != null">tot_amt = #{totAmt},</if>
  173. <if test="isDel != null">is_del = #{isDel},</if>
  174. <if test="orderBeginTime != null">order_begin_time = #{orderBeginTime},</if>
  175. <if test="orderEndTime != null">order_end_time = #{orderEndTime},</if>
  176. <if test="remark != null">remark = #{remark},</if>
  177. </trim>
  178. where id = #{id}
  179. </update>
  180. <!-- <delete id="deleteBmProjectById" parameterType="Long">
  181. delete from bm_project where id = #{id}
  182. </delete>-->
  183. <update id="deleteBmProjectById" parameterType="Long">
  184. update bm_project set is_del = '1' where id = #{id}
  185. </update>
  186. <!-- <delete id="deleteBmProjectByIds" parameterType="String">
  187. delete from bm_project where id in
  188. <foreach item="id" collection="array" open="(" separator="," close=")">
  189. #{id}
  190. </foreach>
  191. </delete>-->
  192. <update id="deleteBmProjectByIds" parameterType="String">
  193. update bm_project set is_del = '1' where id in
  194. <foreach item="id" collection="array" open="(" separator="," close=")">
  195. #{id}
  196. </foreach>
  197. </update>
  198. <select id="selectStatisticsList" resultMap="BmProjectResult">
  199. <include refid="selectBmProjectVo"></include>
  200. <where> is_del = '0'
  201. <if test="deptId != -1">and dept_id = #{deptId}</if>
  202. and project_status in
  203. <foreach item="id" collection="ids" open="(" separator="," close=")">
  204. #{id}
  205. </foreach>
  206. </where>
  207. order by create_time DESC
  208. </select>
  209. <select id="selectProjectEharts" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
  210. SELECT
  211. d.dept_name AS deptName,
  212. ifnull( count(p.id), 0 ) as successMission
  213. FROM
  214. sys_dept d
  215. LEFT JOIN bm_project p ON d.dept_id = p.dept_id
  216. and d.status = '0' and p.project_status in (1,2,3,4) and p.is_del = '0'
  217. AND YEAR (p.create_time ) = #{year}
  218. where d.del_flag = '0'
  219. GROUP BY
  220. d.dept_id
  221. order by successMission DESC
  222. </select>
  223. <select id="selectProjectContractEharts" parameterType="string" resultType="com.ruoyi.system.domain.vo.BmDeptPlanVo">
  224. SELECT
  225. d.dept_name AS deptName,
  226. ifnull( sum( p.tot_amt ), 0 ) AS totAmt,
  227. ifnull( count( p.id ), 0 ) AS successMission
  228. FROM
  229. sys_dept d
  230. LEFT JOIN bm_project p ON d.dept_id = p.dept_id
  231. AND p.project_status &gt; 4
  232. AND p.is_del = '0'
  233. AND YEAR ( p.create_time ) = #{year}
  234. where d.del_flag = '0'
  235. GROUP BY
  236. d.dept_id
  237. order by successMission DESC,
  238. totAmt DESC
  239. </select>
  240. <select id="selectBmProjectInProjectStatus" resultMap="BmProjectResult">
  241. <include refid="selectBmProjectVo"></include>
  242. where project_status = 1
  243. </select>
  244. </mapper>