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.
186 lines
6.1 KiB
186 lines
6.1 KiB
<?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.epmet.modules.partymember.dao.IcPartyMemberPointDao">
|
|
<update id="updateMember">
|
|
UPDATE ic_party_member
|
|
SET TOTAL_SCORE = #{totalScore}
|
|
WHERE
|
|
id = #{partyMemberId}
|
|
</update>
|
|
<update id="updateByPartyMemberId">
|
|
UPDATE ic_party_member_point
|
|
SET BASE_POINT = #{entity.basePoint},
|
|
BASE_OPTIONS = #{entity.baseOptions},
|
|
REVIEW_POINT = #{entity.reviewPoint},
|
|
REVIEW_OPTIONS = #{entity.reviewOptions},
|
|
INSPIRE_POINT = #{entity.inspirePoint},
|
|
INSPIRE_OPTIONS = #{entity.inspireOptions},
|
|
WARN_POINT = #{entity.warnPoint},
|
|
WARN_OPTIONS = #{entity.warnOptions}
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
AND PARTY_MEMBER_ID = #{entity.partyMemberId}
|
|
AND YEAR = #{entity.year}
|
|
AND QUARTER = #{entity.quarter}
|
|
AND CUSTOMER_ID = #{entity.customerId}
|
|
</update>
|
|
|
|
|
|
<select id="getList"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.PartyMemberPointListResultDTO">
|
|
SELECT
|
|
a.year,
|
|
a.PARTY_MEMBER_ID,
|
|
AVG ( a.total_score ) as totalScore,
|
|
c.PARTY_ORG_NAME as partyOrg,
|
|
u.NAME,
|
|
u.MOBILE,
|
|
u.ID_CARD,
|
|
u.REMARK,
|
|
AVG( a.BASE_POINT ) AS BasePoint,
|
|
AVG( a.REVIEW_POINT ) AS reviewPoint,
|
|
AVG( a.INSPIRE_POINT ) AS inspirePoint,
|
|
AVG( a.WARN_POINT ) AS warnPoint
|
|
FROM
|
|
ic_party_member_point a
|
|
LEFT JOIN ic_party_member u ON a.PARTY_MEMBER_ID = u.id
|
|
LEFT JOIN ic_party_org c ON c.id = u.sszb
|
|
<where>
|
|
u.DEL_FLAG = '0' AND a.DEL_FLAG = '0' AND c.DEL_FLAG = '0'
|
|
AND u.CUSTOMER_ID = #{customerId}
|
|
<if test="name != null and name != ''">
|
|
AND u.NAME = #{name}
|
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
|
AND u.MOBILE = #{mobile}
|
|
</if>
|
|
<if test="idCard != null and idCard != ''">
|
|
AND u.ID_CARD = #{idCard}
|
|
</if>
|
|
<if test="year != null and year != ''">
|
|
AND a.YEAR = #{year}
|
|
</if>
|
|
<if test="orgId != null and orgId != ''">
|
|
AND c.id = #{orgId}
|
|
</if>
|
|
|
|
</where>
|
|
GROUP BY a.YEAR,a.PARTY_MEMBER_ID
|
|
ORDER BY
|
|
a.YEAR DESC,
|
|
u.sszb ASC,
|
|
sum( a.total_score ) DESC,
|
|
a.CREATED_TIME
|
|
</select>
|
|
<select id="getListCount"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.PartyMemberPointListCountDTO">
|
|
SELECT
|
|
count( a.BASE_POINT ) AS basePointCount,
|
|
count( a.REVIEW_POINT ) AS reviewPointCount,
|
|
count( a.INSPIRE_POINT ) AS inspirePointCount,
|
|
count( a.WARN_POINT ) AS warnPointCount
|
|
FROM
|
|
ic_party_member u
|
|
LEFT JOIN ic_party_member_point a ON a.PARTY_MEMBER_ID = u.id
|
|
AND a.DEL_FLAG = '0'
|
|
<where>
|
|
u.DEL_FLAG = '0'
|
|
AND u.CUSTOMER_ID = #{customerId}
|
|
<if test="year != null and year != ''">
|
|
AND a.year = #{year}
|
|
</if>
|
|
</where>
|
|
GROUP BY
|
|
u.id
|
|
ORDER BY
|
|
a.YEAR DESC,
|
|
u.sszb ASC,
|
|
a.total_score ASC,
|
|
a.CREATED_TIME
|
|
</select>
|
|
<select id="getEchoPartyMemberPoint"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.PartyMemberPointEchoResultDTO">
|
|
SELECT
|
|
id,
|
|
BASE_POINT,
|
|
BASE_OPTIONS,
|
|
REVIEW_POINT,
|
|
REVIEW_OPTIONS,
|
|
INSPIRE_POINT,
|
|
INSPIRE_OPTIONS,
|
|
WARN_POINT,
|
|
WARN_OPTIONS
|
|
FROM
|
|
ic_party_member_point
|
|
where
|
|
year = #{year}
|
|
AND PARTY_MEMBER_ID = #{partyMemberId}
|
|
AND QUARTER = #{quarter}
|
|
AND DEL_FLAG = '0'
|
|
AND CUSTOMER_ID = #{customerId}
|
|
order by CREATED_TIME
|
|
</select>
|
|
<select id="getExport"
|
|
resultType="com.epmet.resi.partymember.dto.partymember.result.PartyMemberPointExportResultDTO">
|
|
SELECT
|
|
a.year,
|
|
a.QUARTER,
|
|
a.BASE_OPTIONS,
|
|
a.REVIEW_OPTIONS,
|
|
a.INSPIRE_OPTIONS,
|
|
a.WARN_OPTIONS,
|
|
a.TOTAL_SCORE,
|
|
a.PARTY_MEMBER_ID,
|
|
a.BASE_POINT,
|
|
a.REVIEW_POINT,
|
|
a.INSPIRE_POINT,
|
|
a.WARN_POINT,
|
|
sum ( BASE_POINT + REVIEW_POINT + INSPIRE_POINT + WARN_POINT ) as totalScore
|
|
FROM
|
|
ic_party_member u
|
|
LEFT JOIN ic_party_member_point a ON a.PARTY_MEMBER_ID = u.id
|
|
AND a.DEL_FLAG = '0'
|
|
LEFT JOIN ic_party_org c ON c.id = u.sszb
|
|
AND c.DEL_FLAG = '0'
|
|
<where>
|
|
u.DEL_FLAG = '0'
|
|
AND u.CUSTOMER_ID = #{customerId}
|
|
<if test="form.name != null and form.name != ''">
|
|
AND u.NAME = #{form.name}
|
|
</if>
|
|
<if test="form.mobile != null and form.mobile != ''">
|
|
AND u.MOBILE = #{form.mobile}
|
|
</if>
|
|
<if test="form.idCard != null and form.idCard != ''">
|
|
AND u.ID_CARD = #{form.idCard}
|
|
</if>
|
|
<if test="form.year != null and form.year != ''">
|
|
AND a.YEAR = #{form.year}
|
|
</if>
|
|
<if test="form.orgId != null and form.orgId != ''">
|
|
AND c.id = #{form.orgId}
|
|
</if>
|
|
</where>
|
|
GROUP BY u.ID
|
|
ORDER BY
|
|
a.YEAR DESC,
|
|
u.sszb ASC,
|
|
a.total_score ASC,
|
|
a.CREATED_TIME
|
|
</select>
|
|
<select id="getPoint" resultType="java.lang.Integer">
|
|
SELECT
|
|
count(id)
|
|
FROM
|
|
ic_party_member_point
|
|
WHERE
|
|
PARTY_MEMBER_ID = #{partyMemberId}
|
|
AND CUSTOMER_ID = #{customerId}
|
|
AND YEAR = #{year}
|
|
AND QUARTER = #{quarter}
|
|
AND del_flag = '0'
|
|
</select>
|
|
|
|
|
|
</mapper>
|
|
|