LaborServiceDictMapper.xml 3.23 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.subsidy.mapper.LaborServiceDictMapper">

    <select id="labors" resultType="com.subsidy.vo.labor.LaborsVO">
    SELECT
        t.id,
        t.labor_service_name,
        t.short_name,
        t.location,
        t.service_code,
        t2.account_name,
        t2.`password`
    FROM
        labor_service_dict t
        LEFT JOIN administer t2 ON t.id = t2.labor_id
    WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        <if test="laborServiceName != null and laborServiceName != ''">
            AND t.labor_service_name like concat('%',#{laborServiceName} ,'%')
        </if>
    </select>

    <select id="laborAccount" resultType="com.subsidy.vo.labor.LaborAccountVO">
        SELECT distinct
        t2.id,
        t2.user_name,
        t2.`password`,
        t2.telephone,
        t2.remark,
        t2.role,
        t2.account_name
        FROM
        administer t2
        LEFT JOIN administer_labor_mapping t1 ON t2.id = t1.administer_id
        LEFT JOIN labor_service_dict t3 ON t1.labor_id = t3.id
        WHERE
        t2.delete_date IS NULL
        AND t1.delete_date IS NULL
        AND t3.delete_date IS NULL
        AND t2.role = 7
        <if test="accountName != null and accountName != ''">
            and (t3.labor_service_name like concat('%',#{accountName} ,'%') or t2.account_name like concat('%',#{accountName},'%') )
        </if>
    </select>

    <select id="relateLabors" parameterType="long" resultType="com.subsidy.model.LaborServiceDictDO">
        SELECT
            t2.id,
            t2.labor_service_name
        FROM
            administer_labor_mapping t
            LEFT JOIN labor_service_dict t2 ON t.labor_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.administer_id = #{administerId}
    </select>

    <select id="accountLabors" parameterType="long" resultType="long">
        SELECT
            t.labor_id
        FROM
            administer_labor_mapping t
        WHERE
            t.delete_date IS NULL
            AND t.administer_id = #{administerId}
    </select>

    <select id="talentManagement" parameterType="long" resultType="com.subsidy.vo.labor.TalentManagementVO">
        SELECT
            t3.id,
            t3.gender,
            t3.user_name,
            t3.telephone,
            t3.id_card,
            t3.email,
            t3.payroll_account,
            t3.bank,
        IF
            ( t3.open_id IS NULL, '未绑定', '已绑定' ) wechatStatus
        FROM
            labor_group_dict t
            LEFT JOIN group_member_mapping t2 ON t.id = t2.group_id
            LEFT JOIN member t3 ON t2.member_id = t3.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            <if test="laborId != null and laborId != ''">
                AND t.labor_id = #{laborId}
            </if>
            <if test="userName != null and userName != ''" >
                and t3.user_name like concat('%',#{userName} ,'%')
            </if>
            and t2.id is not null
    </select>

</mapper>