|
|
@@ -1,7 +1,7 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.zhongzheng.modules.user.mapper.UserMapper">
|
|
|
|
|
|
<resultMap type="com.zhongzheng.modules.user.domain.User" id="UserResult">
|
|
|
@@ -85,10 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
-
|
|
|
- <select id="selectByRank" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery" resultMap="RanKingUserResult">
|
|
|
- SELECT sum(s.study_duration) AS sum_study,u.nickname,u.avatar FROM `user` u
|
|
|
- LEFT JOIN user_study_record s ON u.user_id=s.user_id where 1=1
|
|
|
+ <select id="selectByRank" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery"
|
|
|
+ resultMap="RanKingUserResult">
|
|
|
+ SELECT sum(s.study_duration) AS sum_study,u.nickname,u.avatar FROM `user` u
|
|
|
+ LEFT JOIN user_study_record s ON u.user_id=s.user_id where 1=1
|
|
|
<if test="userId != null and userId != ''">
|
|
|
AND u.user_id = #{userId}
|
|
|
</if>
|
|
|
@@ -98,44 +98,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
GROUP BY u.user_id
|
|
|
</select>
|
|
|
|
|
|
- <select id="selectByRanks" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery" resultMap="RanKingUserResult">
|
|
|
+ <select id="selectByRanks" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery"
|
|
|
+ resultMap="RanKingUserResult">
|
|
|
SELECT A.*
|
|
|
FROM
|
|
|
- (
|
|
|
- SELECT sum(s.study_duration) AS sum_study,u.nickname,u.avatar FROM `user` u
|
|
|
- LEFT JOIN user_study_record s ON u.user_id=s.user_id where 1=1
|
|
|
+ (
|
|
|
+ SELECT sum(s.study_duration) AS sum_study,u.nickname,u.avatar FROM `user` u
|
|
|
+ LEFT JOIN user_study_record s ON u.user_id=s.user_id where 1=1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
AND s.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- GROUP BY u.user_id ORDER BY sum_study desc LIMIT 20
|
|
|
- ) A where
|
|
|
+ GROUP BY u.user_id ORDER BY sum_study desc LIMIT 20
|
|
|
+ ) A where
|
|
|
A.sum_study >0
|
|
|
</select>
|
|
|
|
|
|
<select id="selectByRankOne" parameterType="integer" resultType="int">
|
|
|
- SELECT
|
|
|
- COUNT(s.sum_study)
|
|
|
- FROM
|
|
|
- (SELECT sum( s.study_duration ) AS sum_study FROM user_study_record s WHERE 1 = 1 GROUP BY s.user_id) s
|
|
|
+ SELECT COUNT(s.sum_study)
|
|
|
+ FROM (SELECT sum(s.study_duration) AS sum_study FROM user_study_record s WHERE 1 = 1 GROUP BY s.user_id) s
|
|
|
WHERE s.sum_study >= #{hourse}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectByRankOneByTime" parameterType="map" resultType="int">
|
|
|
SELECT
|
|
|
- COUNT(s.sum_study)
|
|
|
+ COUNT(s.sum_study)
|
|
|
FROM
|
|
|
- (SELECT sum( s.study_duration ) AS sum_study FROM user_study_record s WHERE 1 = 1
|
|
|
+ (SELECT sum( s.study_duration ) AS sum_study FROM user_study_record s WHERE 1 = 1
|
|
|
<if test="startTime != null and startTime != ''">
|
|
|
and s.create_time BETWEEN #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
- GROUP BY s.user_id) s
|
|
|
+ GROUP BY s.user_id) s
|
|
|
WHERE s.sum_study >= #{hourse}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="selectByOneRank" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery" resultMap="RanKingUserResult">
|
|
|
- SELECT u.nickname,u.avatar FROM `user` u
|
|
|
+ <select id="selectByOneRank" parameterType="com.zhongzheng.modules.user.bo.RanKingUserQuery"
|
|
|
+ resultMap="RanKingUserResult">
|
|
|
+ SELECT u.nickname,u.avatar FROM `user` u
|
|
|
where 1=1
|
|
|
<if test="userId != null and userId != ''">
|
|
|
AND u.user_id = #{userId}
|
|
|
@@ -143,24 +143,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
GROUP BY u.user_id
|
|
|
</select>
|
|
|
<select id="selectUserNum" parameterType="integer" resultType="int">
|
|
|
- SELECT
|
|
|
- COUNT(user_id)
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE 1=1 and user_level = #{grade}
|
|
|
+ SELECT COUNT(user_id)
|
|
|
+ FROM `user`
|
|
|
+ WHERE 1 = 1
|
|
|
+ and user_level = #{grade}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectListByBo" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
|
|
|
SELECT DISTINCT
|
|
|
u.*,
|
|
|
(case WHEN u.union_id is null then 0 ELSE 1 end) as user_bind_wx
|
|
|
- <if test="getOrderNum != null and getOrderNum == 1" >
|
|
|
- ,ou.goods_course_num,ou.goods_bank_num,ou.goods_live_num
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
+ ,ou.goods_course_num,ou.goods_bank_num,ou.goods_live_num
|
|
|
</if>
|
|
|
FROM
|
|
|
`user` u
|
|
|
|
|
|
- <if test="getOrderNum != null and getOrderNum == 1" >
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
sum( CASE WHEN g.goods_type = 1 THEN 1 ELSE 0 END ) AS goods_course_num,
|
|
|
@@ -203,31 +202,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND u.create_time < #{endTime}
|
|
|
</if>
|
|
|
- <if test="userKerWord != null and userKerWord != ''" >
|
|
|
- AND (u.realname like concat('%', #{userKerWord}, '%') OR u.telphone like concat('%', #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') OR u.id_card like concat('%', #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
+ <if test="userKerWord != null and userKerWord != ''">
|
|
|
+ AND (u.realname like concat('%', #{userKerWord}, '%') OR u.telphone like concat('%',
|
|
|
+ #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') OR u.id_card like concat('%',
|
|
|
+ #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
</if>
|
|
|
- <if test="nickname != null and nickname != ''" >
|
|
|
+ <if test="nickname != null and nickname != ''">
|
|
|
AND u.nickname like concat('%', #{nickname}, '%')
|
|
|
</if>
|
|
|
- <if test="telphone != null and telphone != ''" >
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
AND u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="idCard != null and idCard != ''" >
|
|
|
+ <if test="idCard != null and idCard != ''">
|
|
|
AND u.id_card like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="realname != null and realname != ''" >
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
AND u.realname like concat('%', #{realname}, '%')
|
|
|
</if>
|
|
|
- <if test="companyName != null and companyName != ''" >
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
</if>
|
|
|
- <if test="userId != null and userId != ''" >
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
AND u.user_id = #{userId}
|
|
|
</if>
|
|
|
- <if test="empty != null and empty != ''" >
|
|
|
- and u.realname is NOT NULL
|
|
|
+ <if test="empty != null and empty != ''">
|
|
|
+ and u.realname is NOT NULL
|
|
|
</if>
|
|
|
- <if test="goodsSearchKey != null and goodsSearchKey != ''" >
|
|
|
+ <if test="goodsSearchKey != null and goodsSearchKey != ''">
|
|
|
and ( SELECT
|
|
|
count(og.order_goods_id)
|
|
|
FROM
|
|
|
@@ -238,26 +239,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and og.`status` = 1
|
|
|
and og.refund_status in (0,1,3)
|
|
|
and og.pay_status in (2,3,4)
|
|
|
- and (g.goods_name like concat('%', #{goodsSearchKey}, '%') or g.code like concat('%', #{goodsSearchKey}, '%'))
|
|
|
+ and (g.goods_name like concat('%', #{goodsSearchKey}, '%') or g.code like concat('%', #{goodsSearchKey},
|
|
|
+ '%'))
|
|
|
and o.user_id = u.user_id)>0
|
|
|
</if>
|
|
|
- <if test="gradePoint != null and gradePoint == 1" >
|
|
|
- AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id= u.user_id) > 0
|
|
|
+ <if test="gradePoint != null and gradePoint == 1">
|
|
|
+ AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id=
|
|
|
+ u.user_id) > 0
|
|
|
</if>
|
|
|
- <if test="gradePoint != null and gradePoint == 2" >
|
|
|
- AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id= u.user_id) = 0
|
|
|
+ <if test="gradePoint != null and gradePoint == 2">
|
|
|
+ AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id=
|
|
|
+ u.user_id) = 0
|
|
|
</if>
|
|
|
<if test="searchKey != null and searchKey != '' and searchType == 0 ">
|
|
|
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
+ and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%',
|
|
|
+ #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
</if>
|
|
|
- <if test="idCards != null and idCards.size()!=0 and searchType == 0" >
|
|
|
+ <if test="idCards != null and idCards.size()!=0 and searchType == 0">
|
|
|
AND u.id_card in
|
|
|
<foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
|
|
|
#{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="searchType == 1" >
|
|
|
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') or
|
|
|
+ <if test="searchType == 1">
|
|
|
+ and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%',
|
|
|
+ #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') or
|
|
|
u.id_card in
|
|
|
<foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
|
|
|
#{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
@@ -272,12 +278,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="visitStartTime != null and visitStartTime !=''">
|
|
|
and (SELECT
|
|
|
count(*)
|
|
|
- FROM user_visit_log where user_id = u.user_id and create_time>= #{visitStartTime} and #{visitEndTime} >= create_time)>0
|
|
|
+ FROM user_visit_log where user_id = u.user_id and create_time>= #{visitStartTime} and #{visitEndTime} >=
|
|
|
+ create_time)>0
|
|
|
</if>
|
|
|
<if test="studyStartTime != null and studyStartTime !=''">
|
|
|
and (SELECT
|
|
|
count(*)
|
|
|
- FROM user_study_log where user_id = u.user_id and create_time>= #{studyStartTime} and #{studyEndTime} >= create_time)>0
|
|
|
+ FROM user_study_log where user_id = u.user_id and create_time>= #{studyStartTime} and #{studyEndTime} >=
|
|
|
+ create_time)>0
|
|
|
</if>
|
|
|
<if test="gradeName != null and gradeName != ''">
|
|
|
and ( SELECT
|
|
|
@@ -299,14 +307,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<select id="selectListNoTenant" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
|
|
|
SELECT DISTINCT
|
|
|
u.*
|
|
|
- /* ,(case WHEN u.union_id is null then 0 ELSE 1 end) as user_bind_wx */
|
|
|
- <if test="getOrderNum != null and getOrderNum == 1" >
|
|
|
+ /* ,(case WHEN u.union_id is null then 0 ELSE 1 end) as user_bind_wx */
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
,ou.goods_course_num,ou.goods_bank_num,ou.goods_live_num
|
|
|
</if>
|
|
|
FROM
|
|
|
`user` u
|
|
|
|
|
|
- <if test="getOrderNum != null and getOrderNum == 1" >
|
|
|
+ <if test="getOrderNum != null and getOrderNum == 1">
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
sum( CASE WHEN g.goods_type = 1 THEN 1 ELSE 0 END ) AS goods_course_num,
|
|
|
@@ -349,31 +357,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="endTime != null and endTime != ''">
|
|
|
AND u.create_time < #{endTime}
|
|
|
</if>
|
|
|
- <if test="userKerWord != null and userKerWord != ''" >
|
|
|
- AND (u.realname like concat('%', #{userKerWord}, '%') OR u.telphone like concat('%', #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') OR u.id_card like concat('%', #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
+ <if test="userKerWord != null and userKerWord != ''">
|
|
|
+ AND (u.realname like concat('%', #{userKerWord}, '%') OR u.telphone like concat('%',
|
|
|
+ #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') OR u.id_card like concat('%',
|
|
|
+ #{userKerWord,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
</if>
|
|
|
- <if test="nickname != null and nickname != ''" >
|
|
|
+ <if test="nickname != null and nickname != ''">
|
|
|
AND u.nickname like concat('%', #{nickname}, '%')
|
|
|
</if>
|
|
|
- <if test="telphone != null and telphone != ''" >
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
AND u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="idCard != null and idCard != ''" >
|
|
|
+ <if test="idCard != null and idCard != ''">
|
|
|
AND u.id_card like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="realname != null and realname != ''" >
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
AND u.realname like concat('%', #{realname}, '%')
|
|
|
</if>
|
|
|
- <if test="companyName != null and companyName != ''" >
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
</if>
|
|
|
- <if test="userId != null and userId != ''" >
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
AND u.user_id = #{userId}
|
|
|
</if>
|
|
|
- <if test="empty != null and empty != ''" >
|
|
|
+ <if test="empty != null and empty != ''">
|
|
|
and u.realname is NOT NULL
|
|
|
</if>
|
|
|
- <if test="goodsSearchKey != null and goodsSearchKey != ''" >
|
|
|
+ <if test="goodsSearchKey != null and goodsSearchKey != ''">
|
|
|
and ( SELECT
|
|
|
count(og.order_goods_id)
|
|
|
FROM
|
|
|
@@ -384,26 +394,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
and og.`status` = 1
|
|
|
and og.refund_status in (0,1,3)
|
|
|
and og.pay_status in (2,3,4)
|
|
|
- and (g.goods_name like concat('%', #{goodsSearchKey}, '%') or g.code like concat('%', #{goodsSearchKey}, '%'))
|
|
|
+ and (g.goods_name like concat('%', #{goodsSearchKey}, '%') or g.code like concat('%', #{goodsSearchKey},
|
|
|
+ '%'))
|
|
|
and o.user_id = u.user_id)>0
|
|
|
</if>
|
|
|
- <if test="gradePoint != null and gradePoint == 1" >
|
|
|
- AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id= u.user_id) > 0
|
|
|
+ <if test="gradePoint != null and gradePoint == 1">
|
|
|
+ AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id=
|
|
|
+ u.user_id) > 0
|
|
|
</if>
|
|
|
- <if test="gradePoint != null and gradePoint == 2" >
|
|
|
- AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id= u.user_id) = 0
|
|
|
+ <if test="gradePoint != null and gradePoint == 2">
|
|
|
+ AND (SELECT COUNT(u.user_id) FROM class_grade_user cgu where 1=1 AND u.status in (1) and cgu.user_id=
|
|
|
+ u.user_id) = 0
|
|
|
</if>
|
|
|
<if test="searchKey != null and searchKey != '' and searchType == 0 ">
|
|
|
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
+ and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%',
|
|
|
+ #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%'))
|
|
|
</if>
|
|
|
- <if test="idCards != null and idCards.size()!=0 and searchType == 0" >
|
|
|
+ <if test="idCards != null and idCards.size()!=0 and searchType == 0">
|
|
|
AND u.id_card in
|
|
|
<foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
|
|
|
#{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- <if test="searchType == 1" >
|
|
|
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') or
|
|
|
+ <if test="searchType == 1">
|
|
|
+ and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%',
|
|
|
+ #{searchKey,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%') or
|
|
|
u.id_card in
|
|
|
<foreach collection="idCards" item="item" index="index" open="(" close=")" separator=",">
|
|
|
#{item,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
@@ -418,12 +433,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="visitStartTime != null and visitStartTime !=''">
|
|
|
and (SELECT
|
|
|
count(*)
|
|
|
- FROM user_visit_log where user_id = u.user_id and create_time>= #{visitStartTime} and #{visitEndTime} >= create_time)>0
|
|
|
+ FROM user_visit_log where user_id = u.user_id and create_time>= #{visitStartTime} and #{visitEndTime} >=
|
|
|
+ create_time)>0
|
|
|
</if>
|
|
|
<if test="studyStartTime != null and studyStartTime !=''">
|
|
|
and (SELECT
|
|
|
count(*)
|
|
|
- FROM user_study_log where user_id = u.user_id and create_time>= #{studyStartTime} and #{studyEndTime} >= create_time)>0
|
|
|
+ FROM user_study_log where user_id = u.user_id and create_time>= #{studyStartTime} and #{studyEndTime} >=
|
|
|
+ create_time)>0
|
|
|
</if>
|
|
|
<if test="gradeName != null and gradeName != ''">
|
|
|
and ( SELECT
|
|
|
@@ -445,145 +462,122 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
<select id="selectStudyRecordList" resultMap="StudyRecordResult">
|
|
|
SELECT
|
|
|
- usr.study_duration,
|
|
|
- c.course_name,
|
|
|
- pv.title,
|
|
|
- usr.start_time,
|
|
|
- usr.end_time,
|
|
|
- u.realname,
|
|
|
- u.telphone
|
|
|
+ usr.study_duration,
|
|
|
+ c.course_name,
|
|
|
+ pv.title,
|
|
|
+ usr.start_time,
|
|
|
+ usr.end_time,
|
|
|
+ u.realname,
|
|
|
+ u.telphone
|
|
|
FROM
|
|
|
- user_study_record usr
|
|
|
- LEFT JOIN course c ON usr.course_id = c.course_id
|
|
|
- LEFT JOIN course_section cs ON usr.section_id = cs.section_id
|
|
|
- LEFT JOIN polyv_video pv ON cs.polyv_id = pv.polyv_id
|
|
|
- LEFT JOIN `user` u ON usr.user_id = u.user_id
|
|
|
+ user_study_record usr
|
|
|
+ LEFT JOIN course c ON usr.course_id = c.course_id
|
|
|
+ LEFT JOIN course_section cs ON usr.section_id = cs.section_id
|
|
|
+ LEFT JOIN polyv_video pv ON cs.polyv_id = pv.polyv_id
|
|
|
+ LEFT JOIN `user` u ON usr.user_id = u.user_id
|
|
|
WHERE 1=1
|
|
|
- <if test="userId != null and userId != ''" >
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
AND usr.user_id = #{userId}
|
|
|
</if>
|
|
|
- <if test="courseName != null and courseName != ''" >
|
|
|
+ <if test="courseName != null and courseName != ''">
|
|
|
AND c.course_name like concat('%', #{courseName}, '%')
|
|
|
</if>
|
|
|
- <if test="title != null and title != ''" >
|
|
|
+ <if test="title != null and title != ''">
|
|
|
AND pv.title like concat('%', #{title}, '%')
|
|
|
</if>
|
|
|
- <if test="startTime1 != null and startTime1 != ''" >
|
|
|
+ <if test="startTime1 != null and startTime1 != ''">
|
|
|
AND usr.start_time > #{startTime1}
|
|
|
</if>
|
|
|
- <if test="startTime2 != null and startTime2 != ''" >
|
|
|
+ <if test="startTime2 != null and startTime2 != ''">
|
|
|
AND #{startTime2} > usr.start_time
|
|
|
</if>
|
|
|
- <if test="endTime1 != null and endTime1 != ''" >
|
|
|
+ <if test="endTime1 != null and endTime1 != ''">
|
|
|
AND usr.end_time > #{endTime1}
|
|
|
</if>
|
|
|
- <if test="endTime2 != null and endTime2 != ''" >
|
|
|
+ <if test="endTime2 != null and endTime2 != ''">
|
|
|
AND #{endTime2} > usr.end_time
|
|
|
</if>
|
|
|
ORDER BY
|
|
|
- usr.record_id DESC
|
|
|
+ usr.record_id DESC
|
|
|
</select>
|
|
|
|
|
|
|
|
|
<select id="selectLookNum" parameterType="Long" resultType="integer">
|
|
|
- SELECT
|
|
|
- COUNT( user_id )
|
|
|
- FROM
|
|
|
- recruit_interview_message
|
|
|
- WHERE
|
|
|
- 1 = 1
|
|
|
+ SELECT COUNT(user_id)
|
|
|
+ FROM recruit_interview_message
|
|
|
+ WHERE 1 = 1
|
|
|
AND user_id = #{userId}
|
|
|
AND look_status = 0
|
|
|
</select>
|
|
|
|
|
|
<select id="periodSum" parameterType="Long" resultType="Long">
|
|
|
- SELECT
|
|
|
- COUNT(1)
|
|
|
- FROM
|
|
|
- user_period up
|
|
|
- LEFT JOIN user_period_status ups ON ups.period_id = up.id
|
|
|
- LEFT JOIN class_grade_user cgu on up.grade_id = cgu.grade_id and up.user_id = cgu.user_id
|
|
|
- WHERE
|
|
|
- up.user_id = #{userId}
|
|
|
- and ups.period_status =1
|
|
|
+ SELECT COUNT(1)
|
|
|
+ FROM user_period up
|
|
|
+ LEFT JOIN user_period_status ups ON ups.period_id = up.id
|
|
|
+ LEFT JOIN class_grade_user cgu on up.grade_id = cgu.grade_id and up.user_id = cgu.user_id
|
|
|
+ WHERE up.user_id = #{userId}
|
|
|
+ and ups.period_status = 1
|
|
|
and cgu.change_grade = 0
|
|
|
- and ups.`status` in (0,3)
|
|
|
+ and ups.`status` in (0, 3)
|
|
|
</select>
|
|
|
<select id="subscribeSum" parameterType="Long" resultType="Long">
|
|
|
- SELECT
|
|
|
- COUNT(1)
|
|
|
- FROM
|
|
|
- user_subscribe us
|
|
|
- WHERE
|
|
|
- us.user_id = #{userId}
|
|
|
+ SELECT COUNT(1)
|
|
|
+ FROM user_subscribe us
|
|
|
+ WHERE us.user_id = #{userId}
|
|
|
AND us.subscribe_status = 1
|
|
|
- and (us.exam_expend is null or us.exam_expend = 0)
|
|
|
+ and (us.exam_expend is null or us.exam_expend = 0)
|
|
|
</select>
|
|
|
|
|
|
<select id="informSum" parameterType="Long" resultType="Long">
|
|
|
- SELECT
|
|
|
- COUNT(1)
|
|
|
- FROM
|
|
|
- inform_user iu
|
|
|
- WHERE
|
|
|
- iu.user_id = #{userId}
|
|
|
+ SELECT COUNT(1)
|
|
|
+ FROM inform_user iu
|
|
|
+ WHERE iu.user_id = #{userId}
|
|
|
and iu.receipt_status = 0
|
|
|
- and iu.system_status in (1,2)
|
|
|
+ and iu.system_status in (1, 2)
|
|
|
</select>
|
|
|
|
|
|
<select id="orderSum" parameterType="Long" resultType="Long">
|
|
|
- SELECT
|
|
|
- COUNT( 1 )
|
|
|
- FROM
|
|
|
- `order`
|
|
|
- WHERE
|
|
|
- user_id = #{userId}
|
|
|
- AND order_status =0
|
|
|
+ SELECT COUNT(1)
|
|
|
+ FROM `order`
|
|
|
+ WHERE user_id = #{userId}
|
|
|
+ AND order_status = 0
|
|
|
</select>
|
|
|
|
|
|
<select id="queryUserByTelphoneTenant" parameterType="map" resultMap="UserResult">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
- AND status = 1 AND tenant_id = #{tenantId}
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ AND status = 1
|
|
|
+ AND tenant_id = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getUserByTelNotTenant" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler} AND status = 1
|
|
|
+ <select id="getUserByTelNotTenant" parameterType="java.lang.String"
|
|
|
+ resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE telphone = #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ AND status = 1
|
|
|
</select>
|
|
|
|
|
|
- <select id="getUserByIdNumNotTenant" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- id_card = #{idNum,typeHandler=com.zhongzheng.common.type.EncryptHandler} AND status = 1
|
|
|
+ <select id="getUserByIdNumNotTenant" parameterType="java.lang.String"
|
|
|
+ resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE id_card = #{idNum,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ AND status = 1
|
|
|
</select>
|
|
|
|
|
|
<select id="queryUserByIdNumTenant" parameterType="map" resultMap="UserResult">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- id_card = #{idNum,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
- AND status = 1 AND tenant_id = #{tenantId}
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE id_card = #{idNum,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ AND status = 1
|
|
|
+ AND tenant_id = #{tenantId}
|
|
|
</select>
|
|
|
|
|
|
<select id="selectAllUserList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
</select>
|
|
|
|
|
|
<select id="editUserInfo" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo">
|
|
|
@@ -597,76 +591,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
</trim>
|
|
|
WHERE
|
|
|
- user_id = #{userId}
|
|
|
+ user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
<select id="getUserByTel" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- status = 1
|
|
|
- AND(id_card = #{account,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE status = 1
|
|
|
+ AND (id_card = #{account,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
OR telphone = #{account,typeHandler=com.zhongzheng.common.type.EncryptHandler})
|
|
|
</select>
|
|
|
|
|
|
<select id="getUserByAccount" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- status = 1
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE status = 1
|
|
|
AND user_account = #{userAccount}
|
|
|
</select>
|
|
|
|
|
|
<select id="listByIdsNotTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
SELECT
|
|
|
- *
|
|
|
+ *
|
|
|
FROM
|
|
|
- `user`
|
|
|
+ `user`
|
|
|
WHERE
|
|
|
- status = 1 AND user_id IN
|
|
|
- <foreach collection="userIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
- #{item}
|
|
|
- </foreach>
|
|
|
+ status = 1 AND user_id IN
|
|
|
+ <foreach collection="userIds" item="item" index="index" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
</select>
|
|
|
|
|
|
<select id="getByIdNoTenant" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- status = 1 AND user_id = #{userId}
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE status = 1
|
|
|
+ AND user_id = #{userId}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getByCardNoTenant" parameterType="java.lang.String" resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- `user`
|
|
|
- WHERE
|
|
|
- status = 1 AND id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
|
|
|
- LIMIT 1
|
|
|
+ <select id="getByCardNoTenant" parameterType="java.lang.String"
|
|
|
+ resultType="com.zhongzheng.modules.user.domain.User">
|
|
|
+ SELECT *
|
|
|
+ FROM `user`
|
|
|
+ WHERE status = 1
|
|
|
+ AND id_card = #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler} LIMIT 1
|
|
|
</select>
|
|
|
|
|
|
<select id="getUserOrderCount" parameterType="map" resultType="java.lang.Long">
|
|
|
- SELECT
|
|
|
- COUNT(o.order_sn)
|
|
|
- FROM
|
|
|
- `order` o
|
|
|
- INNER JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- AND og.tenant_id = #{tenantId}
|
|
|
- INNER JOIN goods g ON og.goods_id = g.goods_id
|
|
|
- AND g.tenant_id = #{tenantId}
|
|
|
- WHERE
|
|
|
- o.`status` = 1
|
|
|
- AND o.user_id = #{userId}
|
|
|
- AND g.`code` = #{code}
|
|
|
- AND g.goods_name = #{goodsName}
|
|
|
- AND og.refund_status != 2
|
|
|
+ SELECT COUNT(o.order_sn)
|
|
|
+ FROM `order` o
|
|
|
+ INNER JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
+ AND og.tenant_id = #{tenantId}
|
|
|
+ INNER JOIN goods g ON og.goods_id = g.goods_id
|
|
|
+ AND g.tenant_id = #{tenantId}
|
|
|
+ WHERE o.`status` = 1
|
|
|
+ AND o.user_id = #{userId}
|
|
|
+ AND g.`code` = #{code}
|
|
|
+ AND g.goods_name = #{goodsName}
|
|
|
+ AND og.refund_status != 2
|
|
|
AND og.pay_status IN ( 2, 3, 4 )
|
|
|
AND g.`status` = 1
|
|
|
AND og.`status` = 1
|
|
|
@@ -674,51 +655,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="dangAnList" parameterType="com.zhongzheng.modules.user.bo.UserQueryBo" resultMap="UserResult">
|
|
|
- SELECT u.* from `user` u where 1=1
|
|
|
- <if test="telphone != null and telphone != ''" >
|
|
|
+ SELECT u.* from `user` u where 1=1
|
|
|
+ <if test="telphone != null and telphone != ''">
|
|
|
AND u.telphone like concat('%', #{telphone,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="idCard != null and idCard != ''" >
|
|
|
+ <if test="idCard != null and idCard != ''">
|
|
|
AND u.id_card like concat('%', #{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}, '%')
|
|
|
</if>
|
|
|
- <if test="realname != null and realname != ''" >
|
|
|
+ <if test="realname != null and realname != ''">
|
|
|
AND u.realname like concat('%', #{realname}, '%')
|
|
|
</if>
|
|
|
- <if test="companyName != null and companyName != ''" >
|
|
|
+ <if test="companyName != null and companyName != ''">
|
|
|
AND u.company_name like concat('%', #{companyName}, '%')
|
|
|
</if>
|
|
|
- <if test="majorId != null and majorId != ''" >
|
|
|
+ <if test="majorId != null and majorId != ''">
|
|
|
AND (SELECT count(*) FROM `order` o
|
|
|
LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.major_id = #{majorId})>0
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND
|
|
|
+ og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.major_id = #{majorId})>0
|
|
|
</if>
|
|
|
- <if test="educationTypeId != null and educationTypeId != ''" >
|
|
|
+ <if test="educationTypeId != null and educationTypeId != ''">
|
|
|
AND (SELECT count(*) FROM `order` o
|
|
|
LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.education_type_id = #{educationTypeId})>0
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND
|
|
|
+ og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.education_type_id = #{educationTypeId})>0
|
|
|
</if>
|
|
|
- <if test="businessId != null and businessId != ''" >
|
|
|
+ <if test="businessId != null and businessId != ''">
|
|
|
AND (SELECT count(*) FROM `order` o
|
|
|
LEFT JOIN order_goods og ON o.order_sn = og.order_sn
|
|
|
- LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.business_id = #{businessId})>0
|
|
|
+ LEFT JOIN goods g ON og.goods_id = g.goods_id WHERE o.`status` = 1 AND o.user_id = u.user_id AND
|
|
|
+ og.pay_status IN ( 2, 3, 4 ) AND og.refund_status != 2 AND g.business_id = #{businessId})>0
|
|
|
</if>
|
|
|
- <if test="promiseUploadSign != null and promiseUploadSign == 1" >
|
|
|
+ <if test="promiseUploadSign != null and promiseUploadSign == 1">
|
|
|
AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1
|
|
|
AND INSTR(up.key_value,'"fieldKey":"commitment_seal","value":"oss/images/avatar')) > 0
|
|
|
</if>
|
|
|
- <if test="promiseUploadSign != null and promiseUploadSign == 0" >
|
|
|
+ <if test="promiseUploadSign != null and promiseUploadSign == 0">
|
|
|
AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1
|
|
|
AND INSTR(up.key_value,'"fieldKey":"commitment_seal","value":"oss/images/avatar')) = 0
|
|
|
</if>
|
|
|
- <if test="promiseSign != null and promiseSign == 1" >
|
|
|
+ <if test="promiseSign != null and promiseSign == 1">
|
|
|
AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1
|
|
|
AND INSTR(up.key_value,'"fieldKey":"commitment_electr_signature","value":"oss/images/avatar')) > 0
|
|
|
</if>
|
|
|
- <if test="promiseSign != null and promiseSign == 0" >
|
|
|
+ <if test="promiseSign != null and promiseSign == 0">
|
|
|
AND (SELECT COUNT(up.id) FROM user_profile up WHERE up.user_id = u.user_id AND up.current_status = 1
|
|
|
AND INSTR(up.key_value,'"fieldKey":"commitment_electr_signature","value":"oss/images/avatar')) = 0
|
|
|
</if>
|
|
|
order by u.user_id desc
|
|
|
</select>
|
|
|
-
|
|
|
</mapper>
|