综合办公系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

CmcPerformanceStaffMapper.xml 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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.oa.mapper.CmcPerformanceStaffMapper">
  6. <resultMap type="CmcPerformanceStaff" id="CmcPerformanceStaffResult">
  7. <result property="performanceStaffId" column="performance_staff_id" />
  8. <result property="performanceId" column="performance_id" />
  9. <result property="projectId" column="project_id" />
  10. <result property="userId" column="user_id" />
  11. <result property="nickName" column="nick_name" />
  12. <result property="workType" column="work_type" />
  13. <result property="content" column="content" />
  14. <result property="scaleGrade" column="scale_grade" />
  15. <result property="workload" column="workload" />
  16. <result property="unit" column="unit" />
  17. <result property="price" column="price" />
  18. <result property="coefficient" column="coefficient" />
  19. <result property="producePerformance" column="produce_performance" />
  20. <result property="managePerformance" column="manage_performance" />
  21. <result property="performanceMonth" column="performance_month" />
  22. <result property="remark" column="remark" />
  23. <association property="project" javaType="CmcProject" resultMap="CmcProjectResult" />
  24. <association property="user" javaType="SysUser" resultMap="SysUserResult" />
  25. <association property="dept" javaType="SysDept" resultMap="SysDeptResult" />
  26. </resultMap>
  27. <resultMap type="SysUser" id="SysUserResult">
  28. <result property="userId" column="user_id" />
  29. <result property="nickName" column="nick_name" />
  30. </resultMap>
  31. <resultMap type="CmcProject" id="CmcProjectResult">
  32. <result property="projectId" column="project_id" />
  33. <result property="projectNumber" column="project_number" />
  34. <result property="projectName" column="project_name" />
  35. </resultMap>
  36. <resultMap type="SysDept" id="SysDeptResult">
  37. <result property="deptId" column="dept_id" />
  38. <result property="deptName" column="dept_name" />
  39. </resultMap>
  40. <sql id="selectCmcPerformanceStaffVo">
  41. select ps.performance_staff_id, ps.performance_id, ps.project_id, p.project_number, p.project_name, ps.user_id, u.nick_name, d.dept_name, ps.work_type, ps.content, ps.scale_grade, ps.workload, ps.unit, ps.price,
  42. ps.coefficient, ps.produce_performance, ps.manage_performance, ps.performance_month, ps.remark from cmc_performance_staff as ps
  43. left join cmc_project as p on p.project_id = ps.project_id
  44. left join sys_user as u on u.user_id = ps.user_id
  45. left join sys_dept as d on d.dept_id = u.dept_id
  46. </sql>
  47. <select id="selectCmcPerformanceStaffList" parameterType="CmcPerformanceStaff" resultMap="CmcPerformanceStaffResult">
  48. <include refid="selectCmcPerformanceStaffVo"/>
  49. <where>
  50. <if test="performanceId != null and performanceId != ''"> and ps.performance_id = #{performanceId}</if>
  51. <if test="projectId != null and projectId != ''"> and ps.project_id = #{projectId}</if>
  52. <if test="userId != null "> and ps.user_id = #{userId}</if>
  53. <if test="workType != null and workType != ''"> and ps.work_type = #{workType}</if>
  54. <if test="content != null and content != ''"> and ps.content = #{content}</if>
  55. <if test="scaleGrade != null and scaleGrade != ''"> and ps.scale_grade = #{scaleGrade}</if>
  56. <if test="workload != null "> and ps.workload = #{workload}</if>
  57. <if test="unit != null and unit != ''"> and ps.unit = #{unit}</if>
  58. <if test="coefficient != null "> and ps.coefficient = #{coefficient}</if>
  59. <if test="producePerformance != null "> and ps.produce_performance = #{producePerformance}</if>
  60. <if test="performanceMonth != null "> and Month(ps.performance_month) = Month(#{performanceMonth})</if>
  61. </where>
  62. </select>
  63. <select id="selectMonthPerformanceList" parameterType="String" resultMap="CmcPerformanceStaffResult">
  64. select cast(avg(t1.produce_performance) * 1.6 as decimal(10,2)) as manage_performance, t2.produce_performance, t2.user_id, t2.nick_name, t2.dept_name, t2.performance_month
  65. from
  66. (select sum(ps.produce_performance) as produce_performance, u.nick_name, d.dept_name, p.post_name, ps.user_id, ps.performance_month from cmc_performance_staff as ps
  67. left join sys_user as u on u.user_id = ps.user_id
  68. left join sys_dept as d on d.dept_id = u.dept_id
  69. left join sys_user_post as up on u.user_id = up.user_id
  70. left join sys_post as p on p.post_id = up.post_id
  71. where p.post_name != '主任' and p.post_name != '副主任' and ps.performance_id = #{param1} and u.dept_id = #{param2}
  72. group by user_id) as t1,
  73. (select sum(ps.produce_performance) as produce_performance, u.nick_name, d.dept_name, p.post_name, ps.user_id, ps.performance_month from cmc_performance_staff as ps
  74. left join sys_user as u on u.user_id = ps.user_id
  75. left join sys_dept as d on d.dept_id = u.dept_id
  76. left join sys_user_post as up on u.user_id = up.user_id
  77. left join sys_post as p on p.post_id = up.post_id
  78. where p.post_name = '主任' and ps.performance_id = #{param1} and u.dept_id = #{param2}
  79. group by user_id) as t2
  80. union all
  81. select cast(avg(t1.produce_performance) * 1.2 as decimal(10,2)) as manage_performance, t2.produce_performance, t2.user_id, t2.nick_name, t2.dept_name, t2.performance_month
  82. from
  83. (select sum(ps.produce_performance) as produce_performance, u.nick_name, d.dept_name, p.post_name, ps.user_id, ps.performance_month from cmc_performance_staff as ps
  84. left join sys_user as u on u.user_id = ps.user_id
  85. left join sys_dept as d on d.dept_id = u.dept_id
  86. left join sys_user_post as up on u.user_id = up.user_id
  87. left join sys_post as p on p.post_id = up.post_id
  88. where p.post_name != '主任' and p.post_name != '副主任' and ps.performance_id = #{param1} and u.dept_id = #{param2}
  89. group by user_id) as t1,
  90. (select sum(ps.produce_performance) as produce_performance, u.nick_name, d.dept_name, p.post_name, ps.user_id, ps.performance_month from cmc_performance_staff as ps
  91. left join sys_user as u on u.user_id = ps.user_id
  92. left join sys_dept as d on d.dept_id = u.dept_id
  93. left join sys_user_post as up on u.user_id = up.user_id
  94. left join sys_post as p on p.post_id = up.post_id
  95. where p.post_name = '副主任' and ps.performance_id = #{param1} and u.dept_id = #{param2}
  96. group by user_id) as t2
  97. union all
  98. select ps.produce_performance * 0 as manage_performance, sum(ps.produce_performance) as produce_performance, ps.user_id, u.nick_name, d.dept_name, ps.performance_month from cmc_performance_staff as ps
  99. left join sys_user as u on u.user_id = ps.user_id
  100. left join sys_dept as d on d.dept_id = u.dept_id
  101. left join sys_user_post as up on u.user_id = up.user_id
  102. left join sys_post as p on p.post_id = up.post_id
  103. where p.post_name != '主任' and p.post_name != '副主任' and ps.performance_id = #{param1}
  104. group by user_id
  105. </select>
  106. <select id="selectCmcPerformanceStaffByPerformanceStaffId" parameterType="Long" resultMap="CmcPerformanceStaffResult">
  107. <include refid="selectCmcPerformanceStaffVo"/>
  108. where performance_staff_id = #{performanceStaffId}
  109. </select>
  110. <insert id="insertCmcPerformanceStaff" parameterType="CmcPerformanceStaff" useGeneratedKeys="true" keyProperty="performanceStaffId">
  111. insert into cmc_performance_staff
  112. <trim prefix="(" suffix=")" suffixOverrides=",">
  113. <if test="performanceId != null">performance_id,</if>
  114. <if test="projectId != null">project_id,</if>
  115. <if test="userId != null">user_id,</if>
  116. <if test="workType != null">work_type,</if>
  117. <if test="content != null">content,</if>
  118. <if test="scaleGrade != null">scale_grade,</if>
  119. <if test="workload != null">workload,</if>
  120. <if test="unit != null">unit,</if>
  121. <if test="price != null">price,</if>
  122. <if test="coefficient != null">coefficient,</if>
  123. <if test="producePerformance != null">produce_performance,</if>
  124. <if test="performanceMonth != null">performance_month,</if>
  125. <if test="remark != null">remark,</if>
  126. </trim>
  127. <trim prefix="values (" suffix=")" suffixOverrides=",">
  128. <if test="performanceId != null">#{performanceId},</if>
  129. <if test="projectId != null">#{projectId},</if>
  130. <if test="userId != null">#{userId},</if>
  131. <if test="workType != null">#{workType},</if>
  132. <if test="content != null">#{content},</if>
  133. <if test="scaleGrade != null">#{scaleGrade},</if>
  134. <if test="workload != null">#{workload},</if>
  135. <if test="unit != null">#{unit},</if>
  136. <if test="price != null">#{price},</if>
  137. <if test="coefficient != null">#{coefficient},</if>
  138. <if test="producePerformance != null">#{producePerformance},</if>
  139. <if test="performanceMonth != null">#{performanceMonth},</if>
  140. <if test="remark != null">#{remark},</if>
  141. </trim>
  142. </insert>
  143. <update id="updateCmcPerformanceStaff" parameterType="CmcPerformanceStaff">
  144. update cmc_performance_staff
  145. <trim prefix="SET" suffixOverrides=",">
  146. <if test="performanceId != null">performance_id = #{performanceId},</if>
  147. <if test="projectId != null">project_id = #{projectId},</if>
  148. <if test="userId != null">user_id = #{userId},</if>
  149. <if test="workType != null">work_type = #{workType},</if>
  150. <if test="content != null">content = #{content},</if>
  151. <if test="scaleGrade != null">scale_grade = #{scaleGrade},</if>
  152. <if test="workload != null">workload = #{workload},</if>
  153. <if test="unit != null">unit = #{unit},</if>
  154. <if test="price != null">price = #{price},</if>
  155. <if test="coefficient != null">coefficient = #{coefficient},</if>
  156. <if test="producePerformance != null">produce_performance = #{producePerformance},</if>
  157. <if test="performanceMonth != null">performance_month = #{performanceMonth},</if>
  158. <if test="remark != null">remark = #{remark},</if>
  159. </trim>
  160. where performance_staff_id = #{performanceStaffId}
  161. </update>
  162. <delete id="deleteCmcPerformanceStaffByPerformanceStaffId" parameterType="Long">
  163. delete from cmc_performance_staff where performance_staff_id = #{performanceStaffId}
  164. </delete>
  165. <delete id="deleteCmcPerformanceStaffByPerformanceId" parameterType="String">
  166. delete from cmc_performance_staff where performance_id in
  167. <foreach item="performanceId" collection="array" open="(" separator="," close=")">
  168. #{performanceId}
  169. </foreach>
  170. </delete>
  171. </mapper>