ComProjectGroupAssignDAO.xml 2.8 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.yiboshi.science.dao.ComProjectGroupAssignDAO">
    <sql id="allColumns">
        t.id as id, t.expert_id as expertId, t.group_id as group_id, t.assign_year as assignYear, t.remark as remark, t.created as created, t.updated as updated
    </sql>
    <select id="getListByPage" resultType="com.yiboshi.science.param.dto.ComProjectGroupAssignDTO">
        SELECT a.*, c.person_name,c.cert_id,c.sex,c.birthday,c.mobile,c.email,c.education,c.title,
                g.unit_name,d.name knowledge_name,e.name title_name
        FROM com_project_group_assign a
        LEFT JOIN com_expert b ON a.expert_id = b.id
        LEFT JOIN com_person c ON b.person_id = c.id
        LEFT JOIN com_unit g ON c.unit_id = g.id
        left join system_parameter d on a.knowledge_id = d.id and d.type_id = 57
        left join system_parameter e on c.title=e.id and e.type_id = 7
        <where>
            ${ew.sqlSegment}
        </where>
        ORDER BY a.created ASC
    </select>

    <select id="getAssignExpertList" resultType="com.yiboshi.science.param.dto.ComProjectGroupAssignDTO">
        select a.*, c.person_name, c.cert_id, c.sex from com_project_group_assign a
        LEFT JOIN com_expert b ON a.expert_id = b.id
        LEFT JOIN com_person c ON b.person_id = c.id
        where a.group_id = #{groupId} order by created
    </select>

    <select id="getAssignGroupExpertById" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.ComProjectGroupAssignDTO">
        SELECT a.*, c.person_name,c.cert_id,c.sex,c.birthday,c.mobile,c.email,c.education,c.title,
               g.unit_name,d.name education_name,e.name title_name,f.group_name
        FROM com_project_group_assign a
        LEFT JOIN com_expert b ON a.expert_id = b.id
        LEFT JOIN com_person c ON b.person_id = c.id
        LEFT JOIN com_unit g ON c.unit_id = g.id
        left join system_parameter d on c.education=d.id and d.type_id=8
        left join system_parameter e on c.title=e.id and e.type_id=7
        left join com_project_group f on a.group_id=f.id
        where a.id = #{id}
    </select>

    <select id="getProjectAssignByGroupIdExpertId" resultType="com.yiboshi.science.param.dto.ComProjectAssignDTO">
        select a.id as group_id, d.*, e.proj_no, e.proj_name from com_project_group a
            left join com_project_group_detail b on a.id = b.group_id
            left join com_project_group_assign c on a.id = c.group_id
            left join com_project_assign d on b.proj_id = d.proj_id and c.expert_id = d.expert_id
            left join com_project e on d.proj_id = e.id
        where a.id = #{groupId} and c.expert_id = #{expertId} and d.id is not null
    </select>
</mapper>