综合办公系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CmcPerformanceStaffMapper.xml 10KB

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