Newer
Older
casic-metering-biz-xichang / casic-metering-dao / src / main / resources / mapper / resource / BizResourceStaffInfoMapper.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.casic.missiles.mapper.resource.BizResourceStaffInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.resource.BizResourceStaffInfo">
        <id column="id" property="id" />
        <result column="account" property="account" />
        <result column="staff_no" property="staffNo" />
        <result column="staff_name" property="staffName" />
        <result column="picture_file" property="pictureFile" />
        <result column="id_card" property="idCard" />
        <result column="birthday" property="birthday" />
        <result column="native_place" property="nativePlace" />
        <result column="education" property="education" />
        <result column="record_date" property="recordDate" />
        <result column="officer_no" property="officerNo" />
        <result column="gender" property="gender" />
        <result column="graduation_date" property="graduationDate" />
        <result column="nation" property="nation" />
        <result column="degree" property="degree" />
        <result column="dept_id" property="deptId" />
        <result column="dept_name" property="deptName" />
        <result column="station" property="station" />
        <result column="major" property="major" />
        <result column="certificate_number" property="certificateNumber" />
        <result column="engage_date" property="engageDate" />
        <result column="working_age" property="workingAge" />
        <result column="title_initial_date" property="titleInitialDate" />
        <result column="title_recently_date" property="titleRecentlyDate" />
        <result column="academic_start_date" property="academicStartDate" />
        <result column="party_date" property="partyDate" />
        <result column="enlistment_date" property="enlistmentDate" />
        <result column="staff_type" property="staffType" />
        <result column="rank_level" property="rankLevel" />
        <result column="rank_level_date" property="rankLevelDate" />
        <result column="job_level" property="jobLevel" />
        <result column="job_level_date" property="jobLevelDate" />
        <result column="treatment_level" property="treatmentLevel" />
        <result column="treatment_level_date" property="treatmentLevelDate" />
        <result column="working_experience" property="workingExperience" />
        <result column="rank_experience" property="rankExperience" />
        <result column="title_experience" property="titleExperience" />
        <result column="rewards_punishments" property="rewardsPunishments" />
        <result column="remark" property="remark" />
        <result column="education_file" property="educationFile" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, account, staff_no, staff_name, picture_file, id_card, birthday, native_place, education, record_date, officer_no, gender, graduation_date, nation, degree, dept_id, dept_name, station, major, certificate_number, engage_date, working_age, title_initial_date, title_recently_date, academic_start_date, party_date, enlistment_date, staff_type, rank_level, rank_level_date, job_level, job_level_date, treatment_level, treatment_level_date, working_experience, rank_experience, title_experience, rewards_punishments, remark, education_file, create_time, update_time
    </sql>

    <select id="getMaxNo" resultType="java.lang.Long">
        SELECT IFNULL(max(RIGHT(staff_no, 12)), 0) from meter_staff
    </select>

    <select id="selectListPageByTrainId" resultType="com.casic.missiles.model.resource.BizResourceStaffInfo">
        SELECT brsi.*, brts.score AS staffScore
        FROM biz_resource_staff_info brsi
        JOIN biz_resource_train_staff brts ON brsi.id = brts.staff_id
        WHERE brts.train_id = #{id}
    </select>

    <select id="selectNameById" resultType="java.lang.String">
        SELECT staff_name
        FROM biz_resource_staff_info
        WHERE id = #{id}
    </select>
    <resultMap id="personCertificate" type="com.casic.missiles.model.resource.BizResourceStaffInfo">
        <id column="id" property="id" />
        <result column="staff_name" property="staffName" />
        <result column="gender" property="gender"/>
        <result column="birthday" property="birthday"/>
        <collection property="verifierList" ofType="com.casic.missiles.model.resource.BizResourceStaffVerifier" resultMap="verifierDetails">
        </collection>
    </resultMap>

    <resultMap id="verifierDetails" type="com.casic.missiles.model.resource.BizResourceStaffVerifier">
        <id column="vid" property="id"/>
        <result column="cert_no" property="certNo"/>
        <result column="cert_name" property="certName"/>
        <collection property="verifierDetailList" ofType="com.casic.missiles.model.resource.BizResourceStaffVerifierDetail">
            <id column="did" property="id"/>
            <result column="certificate_parameters" property="certificateParameters"/>
        </collection>
    </resultMap>

    <select id="selectPersonCertificate" resultMap="personCertificate">
        select brsi.id,brsi.staff_name,brsi.gender,brsi.birthday,
               brsv.id as vid,brsv.cert_no,brsv.cert_name,
               brsvd.id as did,brsvd.certificate_parameters
        from biz_resource_staff_info brsi left join biz_resource_staff_verifier
            brsv on brsi.id = brsv.staff_id
            left join biz_resource_staff_verifier_detail brsvd
            on brsv.id = brsvd.verifier_id
    </select>

    <select id="selectByUserId" resultType="com.casic.missiles.model.resource.BizResourceStaffInfo">
        SELECT
            brsi.*
        FROM biz_resource_staff_info brsi, sys_user su
        WHERE brsi.account = su.account and su.id = #{userId}
    </select>
<!--    <resultMap id="StaffAuthorizeMap" type="com.casic.missiles.model.resource.BizResourceStaffInfo">-->
<!--        <id column="id" property="id" />-->
<!--        <result column="staff_name" property="staffName" />-->
<!--        <association property="staffAuthorize" javaType="com.casic.missiles.model.resource.BizResourceStaffAuthorize">-->
<!--            <result column="authorize_content" property="authorizeContent" />-->
<!--            <result column="authorize_date" property="authorizeDate" />-->
<!--            <result column="valid_date" property="validDate" />-->
<!--        </association>-->
<!--    </resultMap>-->
    <select id="selectStaffAuthorizeList" resultType="com.casic.missiles.model.resource.BizResourceStaffInfo">
        select brsi.id id,brsi.staff_name staffName,brsa.authorize_content authorizeContent,brsa.authorize_date authorizeDate,brsa.valid_date validDate
        from biz_resource_staff_info brsi
            left join biz_resource_staff_authorize brsa
                on brsi.id = brsa.staff_id
    </select>

    <select id="selectByStaffId" resultType="com.casic.missiles.model.system.UserInfo">
        SELECT su.*
        FROM biz_resource_staff_info brsi
        JOIN sys_user su ON brsi.account = su.ACCOUNT
        WHERE brsi.id = #{staffId}
    </select>
</mapper>