| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 | <?xml version="1.0" encoding="UTF-8" ?><!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.zhongzheng.modules.base.mapper.UserProfileMapper">    <resultMap type="com.zhongzheng.modules.base.domain.UserProfile" id="UserProfileResult">        <result property="id" column="id"/>        <result property="userId" column="user_id"/>        <result property="goodsId" column="goods_id"/>        <result property="status" column="status"/>        <result property="createTime" column="create_time"/>        <result property="updateTime" column="update_time"/>        <result property="oneTime" column="one_time"/>        <result property="lastTime" column="last_time"/>        <result property="keyValue" column="key_value"/>        <result property="createByName" column="create_by_name"/>        <result property="currentStatus" column="current_status"/>        <result property="changeStatus" column="change_status"/>        <result property="text" column="text"/>        <result property="auditTime" column="audit_time"/>    </resultMap>    <resultMap type="com.zhongzheng.modules.base.vo.UserProfileVo" id="UserProfileVo">        <result property="id" column="id"/>        <result property="userId" column="user_id"/>        <result property="goodsId" column="goods_id"/>        <result property="sex" column="sex"/>        <result property="status" column="status"/>        <result property="oneTime" column="one_time"/>        <result property="lastTime" column="last_time"/>        <result property="keyValue" column="key_value"/>        <result property="currentStatus" column="current_status"/>        <result property="changeStatus" column="change_status"/>        <result property="realname" column="realname"/>        <result property="userAccount" column="user_account"/>        <result property="telphone" column="telphone"/>        <result property="idCard" column="id_card"/>        <result property="goodsName" column="goods_name"/>        <result property="goodsCode" column="goods_code"/>        <result property="educationName" column="education_name"/>        <result property="projectName" column="project_name"/>        <result property="businessName" column="business_name"/>        <result property="text" column="text"/>        <result property="auditTime" column="audit_time"/>    </resultMap>    <select id="selectUserProfile" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">        SELECT        up.*,        (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,        (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,        (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,        (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,        (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,        (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,        (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,        (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,        (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name        FROM        user_profile up        LEFT JOIN goods g ON  up.goods_id = g.goods_id LEFT JOIN course_business cb on g.business_id = cb.id        where 1=1        and up.current_status = 1        <if test="status != null and status.size()!=0 ">            AND up.status in            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">                #{item}            </foreach>        </if>        <if test="id != null and id !='' ">            AND up.id =#{id}        </if>        <if test="typeStatus != null and typeStatus !='' ">            and up.type_status = #{typeStatus}        </if>        <if test="userId != null and userId !='' ">            AND up.user_id =#{userId}        </if>        <if test="goodsId != null and goodsId !='' ">            AND up.goods_id =#{goodsId}        </if>        <if test="educationTypeId != null and educationTypeId !='' ">            AND (SELECT cet.id FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) =#{educationTypeId}        </if>        <if test="businessId != null and businessId !='' ">            AND cb.id =#{businessId}        </if>        <if test="schoolId != null and schoolId !='' ">            AND (SELECT g.school_id FROM goods g  where up.goods_id = g.goods_id)  =#{schoolId}        </if>        <if test="majorId != null and majorId !='' ">            AND (SELECT g.major_id FROM goods g  where up.goods_id = g.goods_id) =#{majorId}        </if>        <if test="changeStatus != null and changeStatus !='' ">            AND up.change_status =#{changeStatus}        </if>        <if test="realname != null and realname !='' ">            AND (SELECT count(1) FROM `user` u where u.user_id = up.user_id and u.realname like concat('%', #{realname}, '%') )> 0        </if>        <if test="searchStartTime != null and searchStartTime !='' ">            AND up.create_time >=#{searchStartTime}        </if>        <if test="searchEndTime != null and searchEndTime !='' ">            AND #{searchEndTime} >= up.create_time        </if>        <!-- 数据范围过滤 -->        ${params.dataScope}        order by up.create_time desc    </select>    <select id="getInfo" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">        SELECT        up.*,        (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,        (SELECT u.sex FROM `user` u where u.user_id = up.user_id) as sex,        (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,        (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,        (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,        (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,        (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,        (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,        (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,        (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name        FROM        user_profile up        where 1=1          and up.current_status = 1        <if test="typeStatus != null and typeStatus !='' ">            and up.type_status = #{typeStatus}        </if>        <if test="status != null and status.size()!=0 ">            AND up.status in            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">                #{item}            </foreach>        </if>        <if test="id != null and id !='' ">            AND up.id =#{id}        </if>        <if test="userId != null and userId !='' ">            AND up.user_id =#{userId}        </if>        <if test="goodsId != null and goodsId !='' ">            AND up.goods_id =#{goodsId}        </if>        order by up.create_time desc LIMIT 1    </select>    <select id="listRecord" parameterType="com.zhongzheng.modules.base.bo.UserProfileQueryBo" resultMap="UserProfileVo">        SELECT        up.*,        (SELECT u.realname FROM `user` u where u.user_id = up.user_id) as realname,        (SELECT u.user_account FROM `user` u where u.user_id = up.user_id) as user_account,        (SELECT u.telphone FROM `user` u where u.user_id = up.user_id) as telphone,        (SELECT u.id_card FROM `user` u where u.user_id = up.user_id) as id_card,        (SELECT g.goods_name FROM goods g where up.goods_id = g.goods_id) as goods_name,        (SELECT g.`code` FROM goods g where up.goods_id = g.goods_id) as goods_code,        (SELECT cet.education_name FROM goods g LEFT JOIN course_education_type cet on g.education_type_id = cet.id where up.goods_id = g.goods_id) as education_name,        (SELECT cet.project_name FROM goods g LEFT JOIN course_project_type cet on g.project_id = cet.id where up.goods_id = g.goods_id) as project_name,        (SELECT cet.business_name FROM goods g LEFT JOIN course_business cet on g.business_id = cet.id where up.goods_id = g.goods_id) as business_name        FROM        user_profile up        where 1=1        and up.status != 2        AND up.change_status != 2        <if test="typeStatus != null and typeStatus !='' ">            and up.type_status = #{typeStatus}        </if>        <if test="status != null and status.size()!=0 ">            AND up.status in            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">                #{item}            </foreach>        </if>        <if test="id != null and id !='' ">            AND up.id =#{id}        </if>        <if test="userId != null and userId !='' ">            AND up.user_id =#{userId}        </if>        <if test="goodsId != null and goodsId !='' ">            AND up.goods_id =#{goodsId}        </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="schoolId != null and schoolId !='' ">            AND g.school_id =#{schoolId}        </if>        <if test="majorId != null and majorId !='' ">            AND g.major_id =#{majorId}        </if>        <if test="changeStatus != null and changeStatus !='' ">            AND up.change_status =#{changeStatus}        </if>        order by up.create_time desc    </select>    <select id="selectCountProfile" parameterType="map" resultType="Long">        SELECT            COUNT(1)        FROM            profile_tp p        WHERE            1 = 1          AND FIND_IN_SET(#{goodsId},p.goods_ids)          and FIND_IN_SET(#{userId},p.user_ids)    </select>    <select id="selectGrade" parameterType="map" resultType="Long">        SELECT            cgu.grade_id        FROM            class_grade_user cgu                LEFT JOIN class_grade_goods cgg on cgu.grade_id = cgg.grade_id                LEFT JOIN class_grade cg on cg.grade_id = cgg.grade_id        WHERE            cgu.user_id = #{userId}          and cgg.goods_id = #{goodsId}          and cg.`status` = 1          and cgu.`status` = 1        ORDER BY cgu.create_time desc            LIMIT 1    </select></mapper>
 |