CorePersonnelMapper.xml 2.24 KB
<?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.lframework.xingyun.sc.mappers.CorePersonnelMapper">

    <resultMap id="CorePersonnel" type="com.lframework.xingyun.sc.entity.CorePersonnel">
        <id column="id" property="id"/>
        <result column="credit_id" property="creditId"/>
        <result column="name" property="name"/>
        <result column="sex" property="sex"/>
        <result column="native_place" property="nativePlace"/>
        <result column="age" property="age"/>
        <result column="position" property="position"/>
        <result column="mobile" property="mobile"/>
        <result column="phone" property="phone"/>
        <result column="email" property="email"/>
        <result column="address" property="address"/>
        <result column="create_by_id" property="createById"/>
        <result column="create_by" property="createBy"/>
        <result column="update_by_id" property="updateById"/>
        <result column="update_by" property="updateBy"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>

    <sql id="CorePersonnel_sql">
        SELECT
            tb.id,
            tb.credit_id,
            tb.name,
            tb.sex,
            tb.native_place,
            tb.age,
            tb.position,
            tb.mobile,
            tb.phone,
            tb.email,
            tb.address,
            tb.create_by_id,
            tb.create_by,
            tb.update_by_id,
            tb.update_by,
            tb.create_time,
            tb.update_time
        FROM core_personnel AS tb
    </sql>

    <select id="query" resultMap="CorePersonnel">
        <include refid="CorePersonnel_sql"/>
        <where>
            <if test="vo.creditId != null and vo.creditId != ''">
                AND tb.credit_id = #{vo.creditId}
            </if>
            <if test="vo.name != null and vo.name != ''">
                AND tb.name LIKE CONCAT('%', #{vo.name})
            </if>
            <if test="vo.sex != null and vo.sex != ''">
                AND tb.sex = #{vo.sex}
            </if>
        </where>
    </select>
</mapper>