123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920 |
- <?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.zhongzheng.modules.user.mapper.UserSubscribeMapper">
- <resultMap type="com.zhongzheng.modules.user.domain.UserSubscribe" id="UserSubscribeResult">
- <result property="subscribeId" column="subscribe_id"/>
- <result property="goodsId" column="goods_id"/>
- <result property="userId" column="user_id"/>
- <result property="subscribeStatus" column="subscribe_status"/>
- <result property="beforeStatus" column="before_status"/>
- <result property="examStatus" column="exam_status"/>
- <result property="performance" column="performance"/>
- <result property="result" column="result"/>
- <result property="certificateCode" column="certificate_code"/>
- <result property="applyId" column="apply_id"/>
- <result property="studentType" column="student_type"/>
- <result property="examExpend" column="exam_expend"/>
- <result property="beforeExpend" column="before_expend"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="importNo" column="import_no"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="examineeCode" column="examinee_code"/>
- <result property="reportStatus" column="report_status"/>
- <result property="seatNumber" column="seat_number"/>
- <result property="reportFile" column="report_file"/>
- <result property="siteId" column="site_id"/>
- <result property="syncStatus" column="sync_status"/>
- <result property="roomAddress" column="room_address"/>
- <result property="syncResult" column="sync_result"/>
- <result property="roomName" column="room_name"/>
- <result property="roomId" column="room_id"/>
- <result property="roomCode" column="room_code"/>
- <result property="wisdomExamStatus" column="wisdom_exam_status"/>
- <result property="wisdomReportTime" column="wisdom_report_time"/>
- <result property="wisdomTemperature" column="wisdom_temperature"/>
- <result property="syncExamResult" column="sync_exam_result"/>
- <result property="signaturePushTime" column="signature_push_time"/>
- <result property="reportFileTime" column="report_file_time"/>
- <result property="snapPictures" column="snap_pictures"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.user.vo.UserSubscribeVo" id="UserSubscribeVo">
- <result property="subscribeId" column="subscribe_id"/>
- <result property="goodsId" column="goods_id"/>
- <result property="userId" column="user_id"/>
- <result property="subscribeStatus" column="subscribe_status"/>
- <result property="beforeStatus" column="before_status"/>
- <result property="examStatus" column="exam_status"/>
- <result property="performance" column="performance"/>
- <result property="result" column="result"/>
- <result property="certificateCode" column="certificate_code"/>
- <result property="applyId" column="apply_id"/>
- <result property="studentType" column="student_type"/>
- <result property="examExpend" column="exam_expend"/>
- <result property="beforeExpend" column="before_expend"/>
- <result property="createTime" column="create_time"/>
- <result property="goodsName" column="goods_name"/>
- <result property="categoryName" column="category_name"/>
- <result property="goodsCode" column="goods_code"/>
- <result property="remark" column="remark"/>
- <result property="standPrice" column="stand_price"/>
- <result property="realname" column="realname"/>
- <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="applyName" column="apply_name"/>
- <result property="beforeId" column="before_id"/>
- <result property="beforeName" column="before_name"/>
- <result property="applySiteAddress" column="apply_site_address"/>
- <result property="applySiteStartTime" column="apply_site_start_time"/>
- <result property="applySiteEndTime" column="apply_site_end_time"/>
- <result property="applySiteExamTime" column="apply_site_exam_time"/>
- <result property="applySiteAddressTrain" column="apply_site_address_train"/>
- <result property="applySiteStartTrainTime" column="apply_site_start_train_time"/>
- <result property="applySiteEndTrainTime" column="apply_site_end_train_time"/>
- <result property="applySiteExamTrainTime" column="apply_site_exam_train_time"/>
- <result property="applyStartTime" column="apply_start_time"/>
- <result property="applyEndTime" column="apply_end_time"/>
- <result property="businessId" column="business_id"/>
- <result property="beforeCount" column="before_count"/>
- <result property="beforeName" column="before_name"/>
- <result property="importNo" column="import_no"/>
- <result property="orderGoodsId" column="order_goods_id"/>
- <result property="examineeCode" column="examinee_code"/>
- <result property="reportStatus" column="report_status"/>
- <result property="seatNumber" column="seat_number"/>
- <result property="reportFile" column="report_file"/>
- <result property="siteId" column="site_id"/>
- <result property="syncStatus" column="sync_status"/>
- <result property="roomAddress" column="room_address"/>
- <result property="syncResult" column="sync_result"/>
- <result property="roomName" column="room_name"/>
- <result property="telphone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="idCardImg1" column="id_card_img1"/>
- <result property="idCardImg2" column="id_card_img2"/>
- <result property="oneInchPhotos" column="one_inch_photos"/>
- <result property="centerId" column="center_id"/>
- <result property="applyCode" column="apply_code"/>
- <result property="roomId" column="room_id"/>
- <result property="roomCode" column="room_code"/>
- <result property="wisdomExamStatus" column="wisdom_exam_status"/>
- <result property="wisdomReportTime" column="wisdom_report_time"/>
- <result property="wisdomTemperature" column="wisdom_temperature"/>
- <result property="syncExamResult" column="sync_exam_result"/>
- <result property="signaturePushTime" column="signature_push_time"/>
- <result property="reportFileTime" column="report_file_time"/>
- <result property="applyReportStatus" column="apply_report_status"/>
- <result property="fromPlat" column="from_plat"/>
- <result property="snapPictures" column="snap_pictures"/>
- </resultMap>
- <resultMap type="com.zhongzheng.modules.user.vo.UserVo" id="UserVoResult">
- <result property="telphone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="realname" column="realname"/>
- <result property="job" column="job"/>
- <result property="sex" column="sex"/>
- <result property="telphone" column="telphone" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="idCard" column="id_card" typeHandler="com.zhongzheng.common.type.EncryptHandler"/>
- <result property="eduLevel" column="edu_level"/>
- <result property="oneInchPhotos" column="one_inch_photos"/>
- <result property="idCardImg1" column="id_card_img1"/>
- <result property="idCardImg2" column="id_card_img2"/>
- <result property="keyValue" column="key_value"/>
- <result property="applySiteExamTime" column="apply_site_exam_time"/>
- <result property="applySiteStartTime" column="apply_site_start_time"/>
- <result property="applySiteEndTime" column="apply_site_end_time"/>
- <result property="subscribeId" column="subscribe_id"/>
- <result property="seatNumber" column="seat_number"/>
- </resultMap>
- <select id="listSubscribe" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
- SELECT
- us.*, eb.before_name,
- (SELECT g.goods_name FROM goods g where us.goods_id = g.goods_id) as goods_name,
- (SELECT g.code FROM goods g where us.goods_id = g.goods_id) as goods_code,
- (SELECT g.stand_price FROM goods g where us.goods_id = g.goods_id) as stand_price,
- (SELECT m.category_name FROM goods g LEFT JOIN major m on g.major_id= m.id where us.goods_id = g.goods_id) as category_name,
- u.realname,
- u.id_card,
- (SELECT ea.apply_name FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_name,
- (SELECT ea.apply_start_time FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_start_time,
- (SELECT ea.apply_end_time FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_end_time,
- (SELECT eb.before_name FROM exam_before eb where eb.before_id = us.before_id) as before_name,
- (SELECT ea.report_status FROM exam_apply ea where ea.apply_id = us.apply_id) as apply_report_status,
- (SELECT ueg.do_number-ueg.expend_before FROM user_exam_goods ueg where ueg.goods_id = us.goods_id and ueg.user_id = us.user_id ORDER BY user_exam_goods_id DESC limit 1) as before_count,
- ueg.exam_number,
- ueg.do_number,
- ueg.expend_number,
- es.from_plat,
- ueg.expend_before
- FROM
- user_subscribe us
- LEFT JOIN exam_before eb ON us.before_id = eb.before_id
- LEFT JOIN `user` u ON us.user_id = u.user_id
- LEFT JOIN goods g ON us.goods_id = g.goods_id
- <if test="createUsername != null and createUsername != '' ">
- LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
- </if>
- LEFT JOIN course_business cb on g.business_id = cb.id
- LEFT JOIN user_exam_goods ueg ON ueg.order_goods_id = us.order_goods_id
- LEFT JOIN exam_site es ON us.site_id = es.site_id
- WHERE
- 1 =1
- <if test="applySiteAddress != null and applySiteAddress != '' ">
- and us.apply_site_address = #{applySiteAddress}
- </if>
- <if test="canCancel != null and canCancel == 1 ">
- and us.subscribe_status = 1
- and LEFT(us.apply_site_start_time,2)*3600+RIGHT(us.apply_site_start_time,2)*60+us.apply_site_exam_time > unix_timestamp(now())
- and us.exam_status = 0
- and us.before_status = 0
- </if>
- <if test="canBefore != null and canBefore == 1 ">
- and us.subscribe_status = 1
- and us.exam_status = 0
- and us.before_id = #{beforeId}
- and (SELECT count(*) from exam_before_apply eba LEFT JOIN exam_apply_goods eag on eag.apply_id = eba.apply_id where eba.before_id = #{beforeId} and eag.goods_id = us.goods_id) >0
- and (us.before_status = 1 or (SELECT count(*) from user_exam_goods ueg where ueg.user_id = us.user_id and ueg.goods_id = us.goods_id and ueg.do_number - ueg.expend_before>0)>0)
- </if>
- <if test="canExam != null and canExam == 1 ">
- and us.subscribe_status = 1
- </if>
- <if test="searchKey != null and searchKey != '' and searchType == 0 ">
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
- </if>
- <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}, '%') or
- 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="userId != null and userId != '' ">
- and us.user_id = #{userId}
- </if>
- <if test="goodsId != null and goodsId != '' ">
- and us.goods_id = #{goodsId}
- </if>
- <if test="gradeType != null and gradeType != '' ">
- and g.grade_type = #{gradeType}
- </if>
- <if test="educationTypeId != null and educationTypeId != '' ">
- and g.education_type_id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId != '' ">
- and g.business_id = #{businessId}
- </if>
- <if test="createUsername != null and createUsername != '' ">
- and o.create_username like concat('%', #{create_username}, '%')
- </if>
- <if test="questionOpenNum != null and questionOpenNum != '' ">
- and u.question_open_num = #{questionOpenNum}
- </if>
- <if test="questionMerchantName != null and questionMerchantName != '' ">
- and o.question_merchant_name = #{questionMerchantName}
- </if>
- <if test="orderGoodsId != null and orderGoodsId != '' ">
- and us.order_goods_id = #{orderGoodsId}
- </if>
- <if test="result != null ">
- and us.result = #{result}
- </if>
- <if test="subscribeId != null and subscribeId != '' ">
- and us.subscribe_id = #{subscribeId}
- </if>
- <if test="applySiteExamTime != null and applySiteExamTime != '' ">
- and us.apply_site_exam_time = #{applySiteExamTime}
- </if>
- <if test="monthStartTime != null and monthStartTime != '' ">
- and us.apply_site_exam_time >= #{monthStartTime}
- </if>
- <if test="monthEndTime != null and monthEndTime != '' ">
- and us.apply_site_exam_time <= #{monthEndTime}
- </if>
- <if test="applySiteStartTime != null and applySiteStartTime != '' ">
- and us.apply_site_start_time = #{applySiteStartTime}
- </if>
- <if test="applySiteEndTime != null and applySiteEndTime != '' ">
- and us.apply_site_end_time = #{applySiteEndTime}
- </if>
- <if test="subscribeStatus != null and subscribeStatus != '' ">
- and us.subscribe_status = #{subscribeStatus}
- </if>
- <if test="beforeStatus != null and beforeStatus != '' ">
- and us.before_status = #{beforeStatus}
- </if>
- <if test="applyId != null and applyId != '' ">
- and us.apply_id = #{applyId}
- </if>
- <if test="studentType != null and studentType != '' ">
- and us.student_type = #{studentType}
- </if>
- <if test="examStatus != null ">
- and us.exam_status = #{examStatus}
- </if>
- <if test="beforeStatus != null ">
- and us.before_status = #{beforeStatus}
- </if>
- <if test="examExpend != null ">
- and us.exam_expend is NOT NULL
- </if>
- <if test="beforeExpend != null ">
- and us.before_expend is NOT NULL
- </if>
- <if test="beforeId != null and canBefore == null">
- and us.before_id =#{beforeId}
- </if>
- <if test="exceedExamExpend != null and exceedExamExpend == 1">
- and us.exam_expend = 1
- </if>
- <if test="exceedExamExpend != null and exceedExamExpend == 2">
- and (us.exam_expend is null or us.exam_expend = 0)
- </if>
- <if test="exceed != null ">
- and unix_timestamp(now()) > us.apply_site_exam_time and us.exam_expend is NULL and us.subscribe_status = 1
- </if>
- <if test="majorId != null and majorId != '' ">
- and (SELECT m.id FROM goods g LEFT JOIN major m on g.major_id= m.id where us.goods_id = g.goods_id) = #{majorId}
- </if>
- <if test="realname != null and realname != '' ">
- and (SELECT u.realname FROM `user` u where us.user_id = u.user_id) like concat('%', #{realname}, '%')
- </if>
- <if test="syncStatus != null ">
- and us.sync_status = #{syncStatus}
- </if>
- <!-- 数据范围过滤 -->
- ${params.dataScope}
- order by us.create_time desc
- </select>
- <select id="selectGoodsName" parameterType="string" resultType="String">
- SELECT g.goods_name FROM goods g where g.`code`=#{code} and g.status = 1
- </select>
- <select id="selectGoodsId" parameterType="string" resultType="Long">
- SELECT g.goods_id FROM goods g where g.`code`=#{code} and g.status = 1
- </select>
- <select id="selectUserId" parameterType="map" resultType="Long">
- SELECT u.user_id FROM `user` u where u.realname=#{userName} and u.id_card=#{idCard,typeHandler=com.zhongzheng.common.type.EncryptHandler}
- </select>
- <select id="selectBeforeId" parameterType="map" resultType="Long">
- SELECT eb.before_id FROM exam_before eb where eb.before_name=#{beforeName} and eb.status = 1
- </select>
- <select id="findApplyId" parameterType="map" resultType="Long">
- SELECT ea.apply_id FROM exam_apply ea where ea.apply_name=#{applyName} and ea.status != -1
- </select>
- <select id="selectApplyId" parameterType="map" resultType="Long">
- SELECT ea.apply_id FROM exam_apply ea where ea.apply_name=#{applyName} and ea.status != -1
- </select>
- <select id="selectSubscribeId" parameterType="map" resultType="Long">
- SELECT
- us.subscribe_id
- FROM
- user_subscribe us
- WHERE 1=1
- and us.subscribe_status =1
- and us.apply_id = #{applyId}
- and us.goods_id=#{goodsId}
- and us.user_id = #{userId}
- LIMIT 1
- </select>
- <select id="selectSubscribeUpdateId" parameterType="map" resultMap="UserSubscribeVo">
- SELECT
- us.*
- FROM
- user_subscribe us
- WHERE 1=1
- and us.subscribe_status =1
- and us.apply_id = #{applyId}
- and us.goods_id=#{goodsId}
- and us.user_id = #{userId}
- and us.apply_site_exam_time = #{applySiteExamTime}
- and us.apply_site_start_time = #{applySiteStartTime}
- and us.apply_site_end_time = #{applySiteEndTime}
- and us.apply_site_address = #{applySiteAddress}
- LIMIT 1
- </select>
- <select id="selectAddSubscribeId" parameterType="map" resultType="Long">
- SELECT
- us.subscribe_id
- FROM
- user_subscribe us
- WHERE 1=1
- and ((us.subscribe_status =1 and us.exam_status =0) or us.result = 1)
- and us.apply_id = #{applyId}
- and us.goods_id=#{goodsId}
- and us.user_id = #{userId}
- limit 1
- </select>
- <select id="selectAddSubscribeCount" parameterType="map" resultType="Long">
- SELECT
- COUNT(us.subscribe_id)
- FROM
- user_subscribe us
- WHERE 1=1
- and ((us.subscribe_status =1 and us.exam_status =0) or us.result = 1)
- and us.order_goods_id = #{orderGoodsId}
- and us.user_id = #{userId}
- </select>
- <select id="queryBusinessId" parameterType="map" resultType="Long">
- SELECT
- COUNT( 1 )
- FROM
- user_subscribe us
- LEFT JOIN exam_apply ea ON ea.apply_id = us.apply_id
- LEFT JOIN exam_apply_goods eag on ea.apply_id = eag.apply_id
- LEFT JOIN goods g on eag.goods_id = g.goods_id
- where 1=1
- AND g.business_id = #{businessId}
- AND us.subscribe_id = #{subscribeId}
- </select>
- <select id="timeSend" resultMap="UserSubscribeVo">
- SELECT
- * ,
- (SELECT g.business_id FROM goods g where g.goods_id = us.goods_id) as business_id
- FROM
- user_subscribe us
- WHERE us.subscribe_status = 1
- and unix_timestamp(now())+86400 > us.apply_site_exam_time
- and unix_timestamp(now()) < us.apply_site_exam_time
- and (SELECT COUNT(1) FROM inform_remind ir LEFT JOIN inform_remind_business irb on ir.id = irb.remind_id where ir.id=16 and (SELECT g.business_id FROM goods g where g.goods_id = us.goods_id) = irb.business_id) > 0
- </select>
- <select id="signTimeSend" resultMap="UserSubscribeVo">
- SELECT
- us.*,
- ea.apply_name
- FROM
- user_subscribe us
- LEFT JOIN exam_apply ea on us.apply_id = ea.apply_id
- WHERE us.subscribe_status = 1
- and ea.report_status = 1
- and us.report_status = 0
- and us.signature_push_time is NULL
- and unix_timestamp(now())+86400 > us.apply_site_exam_time
- and unix_timestamp(now()) < us.apply_site_exam_time
- and (SELECT COUNT(1) FROM inform_remind ir LEFT JOIN inform_remind_business irb on ir.id = irb.remind_id where ir.id=34 and (SELECT g.business_id FROM goods g where g.goods_id = us.goods_id) = irb.business_id) > 0
- </select>
- <select id="sendExamSucceed" parameterType="map" resultType="Long">
- SELECT
- COUNT( 1 )
- FROM
- inform_remind ir
- LEFT JOIN inform_remind_business irb on irb.remind_id =ir.id
- LEFT JOIN goods g on g.business_id = irb.business_id
- where 1=1
- and g.goods_id = #{goodsId}
- </select>
- <select id="listSubscribeByUser" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
- SELECT
- us.user_id,
- u.realname,
- u.id_card
- FROM
- ( SELECT user_id FROM user_subscribe GROUP BY user_id ) us
- LEFT JOIN `user` u ON us.user_id = u.user_id
- WHERE
- 1 =1
- <if test="searchKey != null and searchKey != '' ">
- and (u.realname like concat('%', #{searchKey}, '%') or u.id_card like concat('%', #{searchKey}, '%'))
- </if>
- </select>
- <select id="getRecentExam" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
- SELECT
- us.*
- FROM
- user_subscribe us
- WHERE
- 1 =1
- AND us.user_id = #{userId}
- AND us.subscribe_status = 1
- AND LEFT(us.apply_site_start_time,2)*3600+RIGHT(us.apply_site_start_time,2)*60+us.apply_site_exam_time > unix_timestamp(now())
- ORDER by us.apply_site_exam_time limit 1
- </select>
- <select id="getConsoleTestSubscribeNum" parameterType="com.zhongzheng.modules.base.bo.ConsoleQueryBo" resultType="Integer">
- SELECT
- COUNT(us.subscribe_id)
- FROM
- user_subscribe us
- LEFT JOIN goods g ON us.goods_id = g.goods_id
- WHERE
- 1=1
- <if test="orderGoodsId != null">
- AND us.order_goods_id = #{orderGoodsId}
- </if>
- <if test="businessId != null">
- AND g.business_id = #{businessId}
- </if>
- <if test="subscribeStatus != null">
- AND us.subscribe_status = #{subscribeStatus}
- </if>
- <if test="examStatus != null">
- AND us.exam_status = #{examStatus}
- </if>
- <if test="subStartTime != null">
- AND us.create_time > #{subStartTime}
- </if>
- <if test="subEndTime != null">
- AND us.create_time < #{subEndTime}
- </if>
- </select>
- <select id="selectApplyUserList" parameterType="map" resultMap="UserSubscribeVo">
- SELECT
- us.*,
- u.realname,
- u.id_card,
- u.telphone,
- u.id_card_img1,
- u.id_card_img2,
- u.one_inch_photos,
- es.center_id,
- ea.code as apply_code,
- ea.apply_name
- FROM
- user_subscribe us
- LEFT JOIN `user` u on u.user_id =us.user_id
- LEFT JOIN exam_apply ea on us.apply_id = ea.apply_id
- LEFT JOIN exam_site es on us.site_id = es.site_id
- WHERE 1=1
- and us.apply_id = #{applyId}
- and es.from_plat = 2
- </select>
- <select id="listUserExport" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserVoResult">
- SELECT
- us.*,u.company_name,u.job,u.edu_level,u.realname,u.telphone,u.id_card,u.sex,u.id_card_img1,u.id_card_img2,u.one_inch_photos,up.key_value
- FROM
- user_subscribe us
- LEFT JOIN `user` u on u.user_id =us.user_id
- LEFT JOIN user_profile up on us.order_goods_id =up.order_goods_id and up.current_status = 1
- and up.type_status = 1
- WHERE
- us.subscribe_status = 1
- <if test="applyId != null and applyId != '' ">
- and us.apply_id = #{applyId}
- </if>
- <if test="applySiteExamTime != null and applySiteExamTime != '' ">
- and us.apply_site_exam_time = #{applySiteExamTime}
- </if>
- <if test="applySiteStartTime != null and applySiteStartTime != '' ">
- and us.apply_site_start_time = #{applySiteStartTime}
- </if>
- <if test="applySiteEndTime != null and applySiteEndTime != '' ">
- and us.apply_site_end_time = #{applySiteEndTime}
- </if>
- <if test="siteId != null and siteId != '' ">
- and us.site_id = #{siteId}
- </if>
- </select>
- <select id="listSignExport" parameterType="com.zhongzheng.modules.user.bo.UserSubscribeQueryBo" resultMap="UserSubscribeVo">
- SELECT
- us.*,u.realname,u.id_card,u.telphone
- FROM
- user_subscribe us
- LEFT JOIN `user` u on u.user_id =us.user_id
- WHERE
- us.subscribe_status = 1
- <if test="applyId != null and applyId != '' ">
- and us.apply_id = #{applyId}
- </if>
- <if test="applySiteExamTime != null and applySiteExamTime != '' ">
- and us.apply_site_exam_time = #{applySiteExamTime}
- </if>
- <if test="applySiteStartTime != null and applySiteStartTime != '' ">
- and us.apply_site_start_time = #{applySiteStartTime}
- </if>
- <if test="applySiteEndTime != null and applySiteEndTime != '' ">
- and us.apply_site_end_time = #{applySiteEndTime}
- </if>
- <if test="siteId != null and siteId != '' ">
- and us.site_id = #{siteId}
- </if>
- </select>
- <select id="selectMajorId" parameterType="java.lang.String" resultType="java.lang.Long">
- SELECT
- DISTINCT(m.id)
- FROM
- major m
- LEFT JOIN major_project mp ON m.id = mp.major_id
- LEFT JOIN course_project_type cpt ON mp.project_id = cpt.id
- LEFT JOIN course_education_type cet ON cpt.education_id = cet.id
- WHERE
- m.category_name = #{majorName}
- AND INSTR( '施工现场专业人员', cpt.project_name ) > 0
- AND INSTR( '考前培训', cet.education_name ) > 0
- </select>
- <select id="getGoodsIds" parameterType="map" resultType="java.lang.Long">
- SELECT
- DISTINCT(g.goods_id)
- FROM
- `exam_apply` ea
- LEFT JOIN exam_apply_goods eag ON ea.apply_id = eag.apply_id
- LEFT JOIN goods g ON eag.goods_id = g.goods_id
- LEFT JOIN order_goods og ON g.goods_id = og.goods_id
- LEFT JOIN `order` o ON og.order_sn = o.order_sn
- WHERE
- ea.apply_id = #{applyId}
- AND o.user_id = #{userId}
- AND g.major_id = #{majorId}
- AND g.`status` = 1
- AND og.`status` = 1
- AND og.refund_status != 2
- AND og.pay_status IN (2,3,4)
- </select>
- <select id="getExamApplyNum" parameterType="java.lang.String" resultType="java.lang.Integer">
- SELECT
- COUNT( DISTINCT us.user_id )
- FROM
- exam_apply ea
- LEFT JOIN user_subscribe us ON ea.apply_id = us.apply_id
- WHERE
- ea.rel_code = ''
- AND ea.`status` = 1
- AND us.subscribe_status = 1
- </select>
- <select id="getListSubscribe" parameterType="com.zhongzheng.modules.user.bo.UserSubQueryBo" resultType="com.zhongzheng.modules.user.vo.UserSubVo">
- SELECT
- us.subscribe_id,
- us.order_goods_id,
- u.realname AS userName,
- u.id_card AS userCard,
- u.telphone AS userPhone,
- u.company_name AS companyName,
- g.goods_name,
- m.category_name AS majorName,
- t.tenant_name,
- us.create_time,
- us.subscribe_status,
- ( SELECT SUM( ueg.exam_number ) FROM user_exam_goods ueg WHERE us.order_goods_id = ueg.order_goods_id GROUP BY ueg.order_goods_id ) AS applyNum,
- us.exam_status,
- us.result,
- us.performance,
- us.apply_site_exam_time as applyTime,
- us.apply_site_start_time as applyStartTime,
- us.apply_site_end_time as applyEndTime,
- us.apply_site_address as applyAddress,
- us.certificate_start_time as certificateStartTime,
- us.certificate_end_time as certificateEndTime,
- us.certificate_code,
- CASE
- WHEN (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) = 1
- THEN 1
- WHEN (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) >1
- THEN 2
- ELSE 0 END
- AS newApply
- FROM
- user_subscribe us
- LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN major m ON g.major_id = m.id
- LEFT JOIN sys_tenant t ON us.tenant_id = t.tenant_id
- LEFT JOIN `user` u ON us.user_id = u.user_id
- WHERE
- 1 = 1
- <if test="subscribeStatus != null and subscribeStatus != '' and (subscribeStatus == 1 or subscribeStatus == 2)">
- AND us.subscribe_status = #{subscribeStatus}
- </if>
- <if test="subscribeStatus != null and subscribeStatus != '' and subscribeStatus == 3">
- AND (us.subscribe_status = 1 AND #{dataTime} > us.apply_site_exam_time)
- </if>
- <if test="applyStatus != null and applyStatus != '' and applyStatus == 1 ">
- AND ( us.exam_status = 1 AND us.result IS NULL )
- </if>
- <if test="applyStatus != null and applyStatus != '' and applyStatus == 2 ">
- AND ( us.exam_status = 1 AND us.result = 1 )
- </if>
- <if test="applyStatus != null and applyStatus != '' and applyStatus == 3 ">
- AND ( us.exam_status = 1 AND us.result = 0)
- </if>
- <if test="applyNum != null and applyNum != '' ">
- AND ( SELECT SUM( ueg.exam_number ) FROM user_exam_goods ueg WHERE us.order_goods_id = ueg.order_goods_id GROUP BY ueg.order_goods_id ) = #{applyNum}
- </if>
- <if test="newApply != null and newApply != '' and newApply == 1">
- AND (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) = 1
- </if>
- <if test="newApply != null and newApply != '' and newApply == 2">
- AND (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) > 1
- </if>
- <if test="keyWord != null and keyWord != '' ">
- AND (u.realname LIKE concat('%',#{keyWord},'%') OR u.id_card = #{keyWord,typeHandler=com.zhongzheng.common.type.EncryptHandler})
- </if>
- <if test="applySiteExamTime != null and applySiteExamTime != '' ">
- and us.apply_site_exam_time = #{applySiteExamTime}
- </if>
- <if test="monthStartTime != null and monthStartTime != '' ">
- and us.apply_site_exam_time >= #{monthStartTime}
- </if>
- <if test="monthEndTime != null and monthEndTime != '' ">
- and us.apply_site_exam_time <= #{monthEndTime}
- </if>
- <if test="applySiteStartTime != null and applySiteStartTime != '' ">
- and us.apply_site_start_time = #{applySiteStartTime}
- </if>
- <if test="applySiteEndTime != null and applySiteEndTime != '' ">
- and us.apply_site_end_time = #{applySiteEndTime}
- </if>
- <if test="educationId != null and educationId != '' ">
- AND g.education_type_id = #{educationId}
- </if>
- <if test="businessId != null and businessId != '' ">
- AND g.business_id = #{businessId}
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 " >
- AND us.tenant_id in
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- ORDER BY us.create_time DESC
- </select>
- <select id="getQuestionRel" parameterType="java.lang.Long" resultType="com.zhongzheng.modules.goods.domain.GoodsQuestionRel">
- SELECT * FROM goods_question_rel WHERE order_goods_id = #{orderGoodsId} AND `status` = 1 AND question_do_num > 0 LIMIT 1
- </select>
- <select id="listByTimeNoTenant" parameterType="com.zhongzheng.modules.user.bo.SubUserExportBo" resultType="com.zhongzheng.modules.user.domain.UserSubscribe">
- SELECT * FROM user_subscribe
- WHERE subscribe_status = 1 AND exam_status = 0
- <if test="applyTime != null and applyTime != '' ">
- AND apply_site_exam_time = #{applyTime}
- </if>
- <if test="tenantIds != null and tenantIds.size()!=0 " >
- AND tenant_id IN
- <foreach collection="tenantIds" item="item" index="index" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- </select>
- <update id="updateByIdNoTenant" parameterType="com.zhongzheng.modules.user.domain.UserSubscribe">
- UPDATE
- user_subscribe
- SET
- <if test="examStatus != null">
- exam_status = #{examStatus},
- </if>
- <if test="performance != null and performance != '' ">
- performance = #{performance},
- </if>
- <if test="result != null">
- `result` = #{result},
- </if>
- <if test="certificateCode != null and certificateCode != '' ">
- certificate_code = #{certificateCode},
- </if>
- <if test="certificateUrl != null and certificateUrl != '' ">
- certificate_url = #{certificateUrl},
- </if>
- <if test="certificateStartTime != null and certificateStartTime != '' ">
- certificate_start_time = #{certificateStartTime},
- </if>
- <if test="certificateEndTime != null and certificateEndTime != '' ">
- certificate_end_time = #{certificateEndTime},
- </if>
- update_time = unix_timestamp()
- WHERE
- subscribe_id = #{subscribeId}
- </update>
- <select id="listUserApply" parameterType="com.zhongzheng.modules.user.bo.UserApplyRecordBo" resultType="com.zhongzheng.modules.user.vo.UserApplyRecordVo">
- SELECT
- us.subscribe_id,
- us.exam_status,
- us.result as applyStatus,
- us.performance,
- us.create_time,
- g.goods_name,
- CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
- m.category_name AS majorName,
- us.subscribe_status,
- us.apply_site_exam_time AS applyTime,
- us.apply_site_start_time AS applyStarTime,
- us.apply_site_end_time AS applyEndTime,
- CASE
- WHEN (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) = 1
- THEN 1
- WHEN (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) >1
- THEN 0 ELSE NULL END
- AS applyNew
- FROM user_subscribe us
- LEFT JOIN order_goods og ON us.order_goods_id = og.order_goods_id
- LEFT JOIN goods g ON og.goods_id = g.goods_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE 1=1 AND us.exam_status != 0 AND us.subscribe_status = 1
- <if test="userId != null and userId !='' ">
- AND us.user_id = #{userId}
- </if>
- <if test="applyStartTime != null and applyStartTime !=''">
- AND us.apply_site_exam_time >= #{applyStartTime}
- </if>
- <if test="applyEndTime != null and applyEndTime !=''">
- AND us.apply_site_exam_time <= #{applyEndTime}
- </if>
- <if test="educationTypeId != null and educationTypeId !='' ">
- AND cet.id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId !='' ">
- AND cb.id = #{businessId}
- </if>
- <if test="majorId != null and majorId !='' ">
- AND m.id = #{majorId}
- </if>
- <if test="goodsName != null and goodsName !='' ">
- AND g.goods_name LIKE concat('%',#{goodsName},'%')
- </if>
- <if test="applyStatus != null ">
- AND us.result = #{applyStatus}
- </if>
- <if test="applyNew != null and applyNew == 1">
- AND (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) = 1
- </if>
- <if test="applyNew != null and applyNew == 0">
- AND (
- SELECT
- COUNT( usu.order_goods_id )
- FROM
- user_subscribe usu
- WHERE
- usu.user_id = us.user_id
- AND usu.order_goods_id = us.order_goods_id
- AND usu.subscribe_status = 1
- ) > 1
- </if>
- </select>
- <select id="listPromise" parameterType="com.zhongzheng.modules.user.bo.UserPromiseRecordBo" resultType="com.zhongzheng.modules.user.vo.UserPromiseRecordVo">
- SELECT
- up.id,
- up.create_time as uploadTime,
- up.key_value,
- g.goods_name,
- CONCAT(cet.education_name,'-',cb.business_name,cpt.project_name) AS businessName,
- m.category_name AS majorName,
- 1 AS signStatus
- FROM
- user_profile up
- LEFT JOIN goods g ON up.goods_id = g.goods_id
- LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
- LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
- LEFT JOIN course_business cb ON g.business_id = cb.id
- LEFT JOIN major m ON g.major_id = m.id
- WHERE up.`status` != -1 AND up.current_status = 1
- <if test="userId != null ">
- AND up.user_id = #{userId}
- </if>
- <if test="uploadStartTime != null and uploadStartTime !=''">
- AND up.create_time >= #{uploadStartTime}
- </if>
- <if test="uploadEndTime != null and uploadEndTime !=''">
- AND up.create_time <= #{uploadEndTime}
- </if>
- <if test="educationTypeId != null and educationTypeId !='' ">
- AND cet.id = #{educationTypeId}
- </if>
- <if test="businessId != null and businessId !='' ">
- AND cb.id = #{businessId}
- </if>
- <if test="majorId != null and majorId !='' ">
- AND m.id = #{majorId}
- </if>
- <if test="goodsName != null and goodsName !='' ">
- AND g.goods_name LIKE concat('%',#{goodsName},'%')
- </if>
- </select>
- </mapper>
|