<?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.yifu.cloud.plus.v1.yifu.salary.mapper.TOwnDeptMapper">
    <resultMap id="tOwnDeptMap" type="com.yifu.cloud.plus.v1.yifu.salary.entity.TOwnDept">
        <id property="id" column="id"/>
        <result property="deptId" column="dept_id"/>
        <result property="deptNo" column="dept_no"/>
        <result property="deptName" column="dept_name"/>
        <result property="unitName" column="unit_name"/>
    </resultMap>
    <sql id="Base_Column_List">
             a.id,
                  a.dept_id,
                  a.dept_no,
                  a.dept_name,
                  a.unit_name
         </sql>
    <sql id="tOwnDept_where">
        <if test="tOwnDept != null">
            <if test="tOwnDept.id != null">
                AND a.id = #{tOwnDept.id}
            </if>
            <if test="tOwnDept.deptId != null and tOwnDept.deptId.trim() != ''">
                AND a.dept_id = #{tOwnDept.deptId}
            </if>
            <if test="tOwnDept.deptNo != null and tOwnDept.deptNo.trim() != ''">
                AND a.dept_no = #{tOwnDept.deptNo}
            </if>
            <if test="tOwnDept.deptName != null and tOwnDept.deptName.trim() != ''">
                AND a.dept_name = #{tOwnDept.deptName}
            </if>
            <if test="tOwnDept.unitName != null and tOwnDept.unitName.trim() != ''">
                AND a.unit_name = #{tOwnDept.unitName}
            </if>
        </if>
    </sql>
    <!--tOwnDept简单分页查询-->
    <select id="getTOwnDeptPage" resultMap="tOwnDeptMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_own_dept a
        <where>
            1=1
            <include refid="tOwnDept_where"/>
        </where>
    </select>
    <!--tOwnDept简单list查询-->
    <select id="getTOwnDeptIdList" resultType="String">
        SELECT a.dept_id FROM t_own_dept a
    </select>
    <!--获取自有员工身份证-->
    <select id="getOwnEmpList" resultType="String">
		SELECT EMP_IDCARD FROM view_own_employee
    </select>
</mapper>
