Newer
Older
huludao / src / main / resources / mapper / DutyTeamMapper.xml
<?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.newfiber.api.pc.dao.DutyTeamMapper">

    <!-- 通用查询映射结果 -->
    <resultMap type="com.newfiber.api.pc.model.entity.DutyTeam" id="DutyTeamResult">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="dutyPerson" column="duty_person"/>
        <result property="dutyPersonPhone" column="duty_person_phone"/>
        <result property="personFile" column="person_file"/>
        <result property="remark" column="remark"/>
        <result property="status" column="status"/>
        <result property="delFlag" column="del_flag"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        t.id
    	, t.name
    	, t.duty_person
    	, t.duty_person_phone
    	, t.person_file
    	, t.remark
    	, t.status
    	, t.del_flag
    	, t.create_by
    	, t.create_time
    	, t.update_by
    	, t.update_time
	</sql>

    <sql id="Where_Condition">
        <if test="request.name != null and request.name != ''">
            and t.name = #{request.name}
        </if>
        <if test="request.dutyPerson != null and request.dutyPerson != ''">
            and t.duty_person = #{request.dutyPerson}
        </if>
        <if test="request.dutyPersonPhone != null and request.dutyPersonPhone != ''">
            and t.duty_person_phone = #{request.dutyPersonPhone}
        </if>
        <if test="request.personFile != null and request.personFile != ''">
            and t.person_file = #{request.personFile}
        </if>
        <if test="request.status != null and request.status != ''">
            and t.status = #{request.status}
        </if>
    </sql>

    <sql id="Join_Table">

    </sql>

    <select id="selectByCondition" resultMap="DutyTeamResult">
        select
        <include refid="Base_Column_List"/>
        from meet_team t
        <include refid="Join_Table"/>
        where t.del_flag = 0
        <include refid="Where_Condition"/>
        order by t.${request.orderBy}
    </select>

    <select id="selectOneById" resultMap="DutyTeamResult">
        select
        <include refid="Base_Column_List"/>
        from meet_team t
        <include refid="Join_Table"/>
        where t.id = #{id} and t.del_flag = 0
    </select>

</mapper>