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.
273 lines
11 KiB
273 lines
11 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.elink.esua.epdc.modules.activity.dao.ActUserRelationDao">
|
|
|
|
<resultMap type="com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity" id="actUserRelationMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="actId" column="ACT_ID"/>
|
|
<result property="userId" column="USER_ID"/>
|
|
<result property="nickname" column="NICKNAME"/>
|
|
<result property="faceImg" column="FACE_IMG"/>
|
|
<result property="partyFlag" column="PARTY_FLAG"/>
|
|
<result property="realName" column="REAL_NAME"/>
|
|
<result property="sex" column="SEX"/>
|
|
<result property="age" column="AGE"/>
|
|
<result property="mobile" column="MOBILE"/>
|
|
<result property="identityNo" column="IDENTITY_NO"/>
|
|
<result property="status" column="STATUS"/>
|
|
<result property="failureReason" column="FAILURE_REASON"/>
|
|
<result property="auditTime" column="AUDIT_TIME"/>
|
|
<result property="signupTime" column="SIGNUP_TIME"/>
|
|
<result property="revision" column="REVISION"/>
|
|
<result property="createdBy" column="CREATED_BY"/>
|
|
<result property="createdTime" column="CREATED_TIME"/>
|
|
<result property="updatedBy" column="UPDATED_BY"/>
|
|
<result property="updatedTime" column="UPDATED_TIME"/>
|
|
</resultMap>
|
|
<resultMap type="com.elink.esua.epdc.activity.result.ActUserRelationResultDTO" id="actUserRelationResultMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="actId" column="ACT_ID"/>
|
|
<result property="userId" column="USER_ID"/>
|
|
<result property="nickname" column="NICKNAME"/>
|
|
<result property="faceImg" column="FACE_IMG"/>
|
|
<result property="partyFlag" column="PARTY_FLAG"/>
|
|
<result property="realName" column="REAL_NAME"/>
|
|
<result property="sex" column="SEX"/>
|
|
<result property="age" column="AGE"/>
|
|
<result property="mobile" column="MOBILE"/>
|
|
<result property="identityNo" column="IDENTITY_NO"/>
|
|
<result property="status" column="STATUS"/>
|
|
<result property="failureReason" column="FAILURE_REASON"/>
|
|
<result property="auditTime" column="AUDIT_TIME"/>
|
|
<result property="signupTime" column="SIGNUP_TIME"/>
|
|
<result property="actStatus" column="ACT_STATUS"/>
|
|
</resultMap>
|
|
|
|
<select id="isSignUp" resultType="int" parameterType="String">
|
|
select count(*) countNum from epdc_act_user_relation where USER_ID = #{userId}
|
|
and ACT_ID = #{actId}
|
|
and status in ('0' ,'1')
|
|
and DEL_FLAG = 0
|
|
</select>
|
|
|
|
<select id="selectOneActUserRelationInfo" resultType="com.elink.esua.epdc.activity.ActUserRelationDTO"
|
|
parameterType="map">
|
|
select ID,ACT_ID,USER_ID,FACE_IMG,NICKNAME,REAL_NAME,PARTY_FLAG
|
|
from epdc_act_user_relation
|
|
where USER_ID = #{userId}
|
|
and ACT_ID = #{actId}
|
|
<if test="statusList!=null and statusList.size()>0">
|
|
and status in
|
|
<foreach collection="statusList" item="status" index="index" open="(" close=")" separator=",">
|
|
#{status}
|
|
</foreach>
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getActUserRelationPageFromPC" resultMap="actUserRelationResultMap">
|
|
SELECT
|
|
relation.ID,
|
|
relation.ACT_ID,
|
|
relation.USER_ID,
|
|
relation.NICKNAME,
|
|
relation.FACE_IMG,
|
|
relation.PARTY_FLAG,
|
|
relation.REAL_NAME,
|
|
relation.SEX,
|
|
relation.AGE,
|
|
relation.MOBILE,
|
|
relation.IDENTITY_NO,
|
|
relation.STATUS,
|
|
relation.FAILURE_REASON,
|
|
relation.AUDIT_TIME,
|
|
relation.SIGNUP_TIME,
|
|
eai.ACT_STATUS
|
|
FROM
|
|
epdc_act_user_relation relation
|
|
LEFT JOIN epdc_act_info eai on eai.ID = relation.ACT_ID
|
|
WHERE
|
|
relation.DEL_FLAG = '0' AND eai.DEL_FLAG = '0'
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
AND DATE_FORMAT( relation.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND relation.STATUS = #{status}
|
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
|
AND relation.MOBILE = #{mobile}
|
|
</if>
|
|
<if test="realName != null and realName != ''">
|
|
AND relation.REAL_NAME = #{realName}
|
|
</if>
|
|
<if test="actId != null and actId != ''">
|
|
AND relation.ACT_ID = #{actId}
|
|
</if>
|
|
ORDER BY
|
|
relation.CREATED_TIME DESC
|
|
</select>
|
|
<resultMap type="com.elink.esua.epdc.activity.result.ActUserClockResultDTO" id="actUserClockResultMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="actId" column="ACT_ID"/>
|
|
<result property="userId" column="USER_ID"/>
|
|
<result property="nickname" column="NICKNAME"/>
|
|
<result property="faceImg" column="FACE_IMG"/>
|
|
<result property="partyFlag" column="PARTY_FLAG"/>
|
|
<result property="realName" column="REAL_NAME"/>
|
|
<result property="sex" column="SEX"/>
|
|
<result property="age" column="AGE"/>
|
|
<result property="mobile" column="MOBILE"/>
|
|
<result property="identityNo" column="IDENTITY_NO"/>
|
|
<result property="status" column="STATUS"/>
|
|
<result property="failureReason" column="FAILURE_REASON"/>
|
|
<result property="auditTime" column="AUDIT_TIME"/>
|
|
<result property="signupTime" column="SIGNUP_TIME"/>
|
|
</resultMap>
|
|
<select id="getActUserClockPageFromPC" resultMap="actUserClockResultMap">
|
|
SELECT
|
|
relation.ID,
|
|
relation.ACT_ID,
|
|
relation.USER_ID,
|
|
relation.NICKNAME,
|
|
relation.FACE_IMG,
|
|
relation.PARTY_FLAG,
|
|
relation.REAL_NAME,
|
|
relation.SEX,
|
|
relation.AGE,
|
|
relation.MOBILE,
|
|
relation.IDENTITY_NO,
|
|
relation.STATUS,
|
|
relation.FAILURE_REASON,
|
|
relation.AUDIT_TIME,
|
|
relation.SIGNUP_TIME,
|
|
info.SIGNIN_ADDRESS AS clockAddress,
|
|
IF(relation.STATUS ='5','1','0') as checkPoint,
|
|
info.REWARD as point,
|
|
clock.clockCount
|
|
FROM
|
|
epdc_act_user_relation relation
|
|
LEFT JOIN
|
|
(SELECT
|
|
COUNT( * ) AS clockCount,
|
|
ACT_USER_ID
|
|
FROM
|
|
epdc_act_user_clock_log
|
|
WHERE
|
|
DEL_FLAG = '0'
|
|
GROUP BY
|
|
ACT_USER_ID) clock
|
|
ON clock.ACT_USER_ID = relation.ID
|
|
LEFT JOIN
|
|
epdc_act_info info
|
|
ON info.ID = relation.ACT_ID AND info.DEL_FLAG = '0'
|
|
WHERE
|
|
relation.DEL_FLAG = '0'
|
|
AND relation.STATUS IN ('1','2','5','6')
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
AND DATE_FORMAT( relation.CREATED_TIME, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
|
</if>
|
|
|
|
<if test="status != null and status != ''">
|
|
AND relation.STATUS = #{status}
|
|
</if>
|
|
<if test="mobile != null and mobile != ''">
|
|
AND relation.MOBILE = #{mobile}
|
|
</if>
|
|
<if test="realName != null and realName != ''">
|
|
AND relation.REAL_NAME = #{realName}
|
|
</if>
|
|
<if test="actId != null and actId != ''">
|
|
AND relation.ACT_ID = #{actId}
|
|
</if>
|
|
ORDER BY
|
|
relation.CREATED_TIME DESC
|
|
</select>
|
|
<resultMap type="com.elink.esua.epdc.activity.result.ActInfoClockResultDTO" id="actInfoClockResultMap">
|
|
<result property="id" column="ID"/>
|
|
<result property="actId" column="ACT_ID"/>
|
|
<result property="status" column="STATUS"/>
|
|
<result property="failureReason" column="FAILURE_REASON"/>
|
|
<result property="address" column="SIGNIN_ADDRESS"/>
|
|
<result property="latitude" column="SIGNIN_LATITUDE"/>
|
|
<result property="longitude" column="SIGNIN_LONGITUDE"/>
|
|
<result property="radius" column="CLOCK_RADIUS"/>
|
|
|
|
</resultMap>
|
|
<select id="getActDetail" resultMap="actInfoClockResultMap">
|
|
SELECT
|
|
relation.ID,
|
|
relation.ACT_ID,
|
|
relation.STATUS,
|
|
relation.FAILURE_REASON,
|
|
info.SIGNIN_ADDRESS,
|
|
info.SIGNIN_LATITUDE,
|
|
info.SIGNIN_LONGITUDE,
|
|
info.CLOCK_RADIUS
|
|
FROM
|
|
epdc_act_user_relation relation
|
|
LEFT JOIN
|
|
epdc_act_info info
|
|
ON info.ID = relation.ACT_ID AND info.DEL_FLAG = '0'
|
|
WHERE
|
|
relation.DEL_FLAG = '0'
|
|
AND relation.ID = #{id}
|
|
ORDER BY
|
|
relation.CREATED_TIME DESC
|
|
</select>
|
|
|
|
<select id="selectListActUserRelation" resultType="com.elink.esua.epdc.activity.ActClockListDTO" parameterType="String">
|
|
select
|
|
aur.FACE_IMG faceImg,
|
|
aur.NICKNAME nickname,
|
|
aur.PARTY_FLAG partyFlag,
|
|
auc.CLOCK_TIME clockTime,
|
|
auc.CLOCK_DESC clockDesc,
|
|
auc.ID id
|
|
from epdc_act_user_relation aur
|
|
left join epdc_act_user_clock_log auc on aur.ID = auc.ACT_USER_ID
|
|
where aur.DEL_FLAG = '0' and auc.DEL_FLAG = '0'
|
|
and aur.ACT_ID = #{actId}
|
|
order by auc.CLOCK_TIME desc
|
|
</select>
|
|
|
|
<select id="selectListClockImg" resultType="com.elink.esua.epdc.activity.ActClockPicDTO">
|
|
select CLOCK_ID,CLOCK_PIC
|
|
from epdc_act_clock_pic
|
|
where DEL_FLAG = '0'
|
|
and CLOCK_ID IN
|
|
<foreach collection="idArr" item="id" index="index" open="(" close=")" separator=",">
|
|
#{id}
|
|
</foreach>
|
|
order by CREATED_TIME asc
|
|
</select>
|
|
|
|
<select id="selectListActUserInfo" resultType="com.elink.esua.epdc.activity.ActUserRelationDTO"
|
|
parameterType="String">
|
|
select ID,ACT_ID,USER_ID,FACE_IMG,NICKNAME,REAL_NAME,PARTY_FLAG
|
|
from epdc_act_user_relation
|
|
where ACT_ID = #{actId}
|
|
and status = '0'
|
|
</select>
|
|
|
|
<!-- 根据用户id+活动id活动信息表 -->
|
|
<select id="selectOneByUserIdAndActId" parameterType="map"
|
|
resultType="com.elink.esua.epdc.modules.activity.entity.ActUserRelationEntity">
|
|
select * from epdc_act_user_relation eaur
|
|
where eaur.DEL_FLAG='0'
|
|
and eaur.ACT_ID=#{actId}
|
|
and eaur.USER_ID=#{userId}
|
|
</select>
|
|
|
|
<!-- 根据活动id查询所有已经报名的用户 -->
|
|
<select id="selectAllSignUpUsers" parameterType="java.lang.String"
|
|
resultType="com.elink.esua.epdc.activity.ActUserRelationDTO">
|
|
SELECT
|
|
eaur.*
|
|
FROM
|
|
epdc_act_user_relation eaur
|
|
WHERE
|
|
eaur.DEL_FLAG = '0'
|
|
AND eaur.`STATUS` IN ( '0', '1' )
|
|
AND eaur.ACT_ID = #{actId}
|
|
</select>
|
|
</mapper>
|
|
|