Blame view

UserMapper.xml 3.96 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
<?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.laowu.mapper.UserMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.laowu.model.UserDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="name" property="userName" />
        <result column="telephone" property="telephone" />
        <result column="email" property="email" />
        <result column="id_card" property="idCard" />
        <result column="area" property="area" />
        <result column="address" property="address" />
        <result column="to_city" property="toCity" />
        <result column="school" property="school" />
        <result column="study_period" property="studyPeriod" />
        <result column="education" property="education" />
        <result column="rank" property="rank" />
        <result column="education_type" property="educationType" />
        <result column="job_status" property="jobStatus" />
        <result column="job" property="job" />
        <result column="company_name" property="companyName" />
        <result column="job_type" property="jobType" />
        <result column="job_start_date" property="jobStartDate" />
        <result column="job_end_date" property="jobEndDate" />
        <result column="job_month" property="jobMonth" />
        <result column="salary" property="salary" />
        <result column="resume" property="resume" />
        <result column="party_member" property="partyMember" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        id, name, telephone, email, id_card, area, address, to_city, school, study_period, education, rank, education_type, job_status, job, company_name, job_type, job_start_date, job_end_date, job_month, salary, resume, party_member, end_date
    </sql>

    <select id="users" resultType="com.laowu.vo.user.UsersVO">
        SELECT
            id,
            user_type,
            user_name,
            telephone,
            email,
            id_card,
            area,
            address,
            to_city,
            school,
            study_period,
            education,
            rank,
            education_type,
            job_status,
            job,
            company_name,
            job_type,
            job_start_date,
            job_end_date,
            job_month,
            salary,
            resume,
            party_member
        FROM
            `user` t
        WHERE
            t.delete_date IS NULL
            <if test="userType = null and userType != ''">
                and t.user_type = #{userType}
            </if>
            <if test="education != null and education != ''">
                AND t.education = #{education}
            </if>
            <if test="partyMember != null and partyMember != ''">
                AND t.party_member = #{partyMember}
            </if>
            <if test="userName != null and userName != ''">
                AND ( t.`name` LIKE  concat('%', #{userName}, '%') or t.company_name like  concat('%', #{userName}, '%'))
            </if>
    </select>

    <select id="oneUser" parameterType="long" resultType="com.laowu.vo.user.UsersVO">
        SELECT
        id,
        user_type,
        user_name,
        telephone,
        email,
        id_card,
        area,
        address,
        to_city,
        school,
        study_period,
        education,
        rank,
        education_type,
        job_status,
        job,
        company_name,
        job_type,
        job_start_date,
        job_end_date,
        job_month,
        salary,
        resume,
        party_member
        FROM
        `user` t
        WHERE
        t.delete_date IS NULL
        and t.id = #{id}
    </select>
</mapper>