cyx-ament-pc/cyx-system/src/main/resources/mapper/base/TAmentPartyAffairsMapper.xml

263 lines
11 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cyx.web.base.mapper.TAmentPartyAffairsMapper">
<resultMap type="TAmentPartyAffairs" id="TAmentPartyAffairsResult">
<result property="id" column="id" />
<result property="type" column="type" />
<result property="unit" column="unit" />
<result property="target" column="target" />
<result property="demand" column="demand" />
<result property="detailed" column="detailed" />
<result property="score" column="score" />
<result property="method" column="method" />
<result property="head" column="head" />
<result property="reviewed" column="reviewed" />
<result property="finishDate" column="finish_date" />
<result property="perId" column="per_id" />
<result property="deptId" column="dept_id" />
<result property="branchId" column="branch_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="files" column="files" />
</resultMap>
<sql id="selectTAmentPartyAffairsVo">
select id, type, files, unit, target, demand, detailed, score, method, head, reviewed, finish_date, per_id, dept_id, branch_id, create_by, create_time, update_by, update_time, remark from t_ament_party_affairs
</sql>
<select id="selectTAmentPartyAffairsList" parameterType="TAmentPartyAffairs" resultMap="TAmentPartyAffairsResult">
<include refid="selectTAmentPartyAffairsVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="target != null and target != ''">
AND target like concat('%', #{target}, '%')
</if>
<if test="demand != null and demand != ''">
AND demand like concat('%', #{demand}, '%')
</if>
<if test="detailed != null and detailed != ''"> and detailed = #{detailed}</if>
<if test="score != null and score != ''"> and score = #{score}</if>
<if test="method != null and method != ''"> and method = #{method}</if>
<if test="head != null and head != ''"> and head = #{head}</if>
<if test="reviewed != null and reviewed != ''"> and reviewed = #{reviewed}</if>
<if test="finishDate != null "> and finish_date = #{finishDate}</if>
<if test="perId != null "> and per_id = #{perId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="branchId != null "> and branch_id = #{branchId}</if>
</where>
</select>
<select id="selectTAmentPartyAffairsListAll" parameterType="TAmentPartyAffairs" resultMap="TAmentPartyAffairsResult">
select
a.*,
b.`name` oprator,
c.`name` reviewer,
d.`name` header,
e.branch_name branch,
f.dept_name deptName
FROM
t_ament_party_affairs a
LEFT JOIN t_ament_personnel b ON a.per_id = b.id
LEFT JOIN t_ament_personnel c ON a.reviewed = c.id
LEFT JOIN t_ament_personnel d ON a.head = d.id
LEFT JOIN t_ament_branch e ON a.branch_id = e.branch_id
LEFT JOIN sys_dept f ON a.dept_id = f.dept_id
</select>
<select id="selectTAmentPartyAffairsById" parameterType="Long" resultMap="TAmentPartyAffairsResult">
<include refid="selectTAmentPartyAffairsVo"/>
where id = #{id}
</select>
<select id="dwysxt" resultType="map">
SELECT
shot_name,
SUM( score ) score,
IF( SUM( now_score ), SUM( now_score ), 0 ) nowScore
FROM
t_ament_party_affairs
WHERE
type = '党务及意识形态'
GROUP BY
shot_name
</select>
<select id="dflzjs" resultType="map">
SELECT
shot_name,
SUM( score ) score,
IF( SUM( now_score ), SUM( now_score ), 0 ) nowScore
FROM
t_ament_party_affairs
WHERE
type = '党风廉政建设'
GROUP BY
shot_name
</select>
<select id="rckhzb" resultType="map">
SELECT
shot_name,
SUM( score ) score,
IF( SUM( now_score ), SUM( now_score ), 0 ) nowScore
FROM
t_ament_party_affairs
WHERE
type = '日常考核指标'
GROUP BY
shot_name
</select>
<select id="ndkhbz" resultType="map">
SELECT
shot_name,
SUM( score ) score,
IF( SUM( now_score ), SUM( now_score ), 0 ) nowScore
FROM
t_ament_party_affairs
WHERE
type = '年度考核指标'
GROUP BY
shot_name
</select>
<select id="bmwcqk" resultType="map">
SELECT
a.dept_id,
d.dept_name,
a.type,
SUM( a.score ) score,
IF( sum( a.now_score ), sum( a.now_score ), 0 ) nowScore
FROM
t_ament_party_affairs a LEFT JOIN sys_dept d on a.dept_id = d.dept_id
WHERE
a.type IN ( '日常考核指标', '年度考核指标' )
GROUP BY
a.dept_id,
a.type
</select>
<select id="groupAll" resultType="map">
SELECT
shot_name,
type,
SUM( score ) score,
IF( SUM( now_score ), SUM( now_score ), 0 ) nowScore,
ROUND(IF( SUM( now_score ), SUM( now_score ), 0 )/ SUM( score )*100) percent
FROM
t_ament_party_affairs
GROUP BY
type
</select>
<select id="finishedstaticList" resultType="map">
SELECT
a.*,
ROUND( a.now_score / a.score *100) percent,
a.shot_name shotName,
a.now_score nowScore,
b.`name` oprator,
c.`name` reviewer,
d.`name` header,
e.branch_name branch,
f.dept_name deptName
FROM
t_ament_party_affairs a
LEFT JOIN t_ament_personnel b ON a.per_id = b.id
LEFT JOIN t_ament_personnel c ON a.reviewed = c.id
LEFT JOIN t_ament_personnel d ON a.head = d.id
LEFT JOIN t_ament_branch e ON a.branch_id = e.branch_id
LEFT JOIN sys_dept f ON a.dept_id = f.dept_id
GROUP BY
a.type,
a.shot_name
</select>
<insert id="insertTAmentPartyAffairs" parameterType="TAmentPartyAffairs" useGeneratedKeys="true" keyProperty="id">
insert into t_ament_party_affairs
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">type,</if>
<if test="unit != null">unit,</if>
<if test="target != null">target,</if>
<if test="demand != null">demand,</if>
<if test="detailed != null">detailed,</if>
<if test="score != null">score,</if>
<if test="method != null">method,</if>
<if test="head != null">head,</if>
<if test="reviewed != null">reviewed,</if>
<if test="finishDate != null">finish_date,</if>
<if test="perId != null">per_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="branchId != null">branch_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="files != null">files = #{files},</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null and type != ''">#{type},</if>
<if test="unit != null">#{unit},</if>
<if test="target != null">#{target},</if>
<if test="demand != null">#{demand},</if>
<if test="detailed != null">#{detailed},</if>
<if test="score != null">#{score},</if>
<if test="method != null">#{method},</if>
<if test="head != null">#{head},</if>
<if test="reviewed != null">#{reviewed},</if>
<if test="finishDate != null">#{finishDate},</if>
<if test="perId != null">#{perId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="branchId != null">#{branchId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="files != null">files = #{files},</if>
</trim>
</insert>
<update id="updateTAmentPartyAffairs" parameterType="TAmentPartyAffairs">
update t_ament_party_affairs
<trim prefix="SET" suffixOverrides=",">
<if test="type != null and type != ''">type = #{type},</if>
<if test="unit != null">unit = #{unit},</if>
<if test="target != null">target = #{target},</if>
<if test="demand != null">demand = #{demand},</if>
<if test="detailed != null">detailed = #{detailed},</if>
<if test="score != null">score = #{score},</if>
<if test="method != null">method = #{method},</if>
<if test="head != null">head = #{head},</if>
<if test="reviewed != null">reviewed = #{reviewed},</if>
<if test="finishDate != null">finish_date = #{finishDate},</if>
<if test="perId != null">per_id = #{perId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="branchId != null">branch_id = #{branchId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="files != null">files = #{files},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTAmentPartyAffairsById" parameterType="Long">
delete from t_ament_party_affairs where id = #{id}
</delete>
<delete id="deleteTAmentPartyAffairsByIds" parameterType="String">
delete from t_ament_party_affairs where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>