<?xml version="1.0" encoding="UTF-8"?>
|
|
<!--
|
~
|
~ Copyright (c) 2018-2025, ztt All rights reserved.
|
~
|
~ Redistribution and use in source and binary forms, with or without
|
~ modification, are permitted provided that the following conditions are met:
|
~
|
~ Redistributions of source code must retain the above copyright notice,
|
~ this list of conditions and the following disclaimer.
|
~ Redistributions in binary form must reproduce the above copyright
|
~ notice, this list of conditions and the following disclaimer in the
|
~ documentation and/or other materials provided with the distribution.
|
~ Neither the name of the pig4cloud.com developer nor the names of its
|
~ contributors may be used to endorse or promote products derived from
|
~ this software without specific prior written permission.
|
~ Author: ztt
|
~
|
-->
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.chinaztt.mes.basic.mapper.StaffMapper">
|
|
<resultMap id="staffMap" type="com.chinaztt.mes.basic.entity.Staff">
|
<id property="id" column="id"/>
|
<result property="staffNo" column="staff_no"/>
|
<result property="staffName" column="staff_name"/>
|
<result property="phone" column="phone"/>
|
<result property="email" column="email"/>
|
<result property="post" column="post"/>
|
<result property="postId" column="post_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createUser" column="create_user"/>
|
<result property="updateUser" column="update_user"/>
|
<result property="divisionName" column="division_name"/>
|
<result property="personnelFactor" column="personnel_factor"/>
|
<result property="crewId" column="crew_id"/>
|
<result property="personNature" column="person_nature"/>
|
<result property="trialDeadline" column="trial_deadline"/>
|
<!-- <result property="divisionName" column="division_name"/>-->
|
<result property="factoryId" column="factory_id"/>
|
<result property="factoryName" column="factory_name"/>
|
<result property="companyId" column="company_id"/>
|
<result property="companyName" column="company_name"/>
|
</resultMap>
|
|
|
<sql id="staffPage">
|
SELECT
|
staff."id",staff.division_id,staff.staff_no,staff.staff_name,
|
staff.phone,staff.email,bp.post_name post,staff.create_time,staff.update_time,
|
staff.create_user,staff.update_user,staff.active,staff.personnel_factor,staff.post_id,
|
division.division_name division_name,staff.person_nature,staff.trial_deadline,staff.company_name,staff.factory_name
|
FROM
|
basic_staff staff
|
left join basic_post bp on bp."id"=staff.post_id
|
LEFT OUTER JOIN basic_division division ON staff.division_id = division.id
|
where staff.active = true ORDER BY create_time DESC
|
</sql>
|
<select id="getStaffPage" resultMap="staffMap">
|
select * from (<include refid="staffPage"/>) a
|
<if test="ew.emptyOfWhere == false">
|
<where>
|
${ew.SqlSegment}
|
</where>
|
</if>
|
</select>
|
|
|
<select id="toResource" resultMap="staffMap">
|
SELECT
|
basic_staff.*,
|
basic_division.division_name division_name
|
FROM
|
basic_staff ,
|
basic_division
|
WHERE
|
NOT EXISTS (
|
SELECT aps_resource.resource_no FROM aps_resource WHERE aps_resource.resource_no = basic_staff.staff_no
|
) AND
|
basic_division."id" = basic_staff.division_id
|
</select>
|
<select id="selectStaffByCrewId" resultMap="staffMap">
|
select staff."id",staff.division_id,staff.staff_no,staff.staff_name,
|
staff.phone,staff.email,bp.post_name post,staff.create_time,staff.update_time,
|
staff.create_user,staff.update_user,staff.active,staff.personnel_factor,staff.post_id,
|
bjcs.*,bd.division_name
|
from basic_staff staff
|
left join basic_join_crew_staff bjcs on bjcs.staff_id=staff."id"
|
left join basic_division bd on bd."id"=staff.division_id
|
left join basic_post bp on bp."id"=staff.post_id
|
where staff.active=true
|
<if test="ew.emptyOfWhere == false">
|
and ${ew.SqlSegment}
|
</if>
|
</select>
|
<select id="selectStaffById" resultMap="staffMap">
|
select bs.*
|
from basic_staff bs
|
left join basic_join_crew_staff bjcs on bjcs.staff_id=bs."id"
|
where bjcs.crew_id=#{id}
|
</select>
|
|
<select id="selectListAll" resultType="com.chinaztt.mes.basic.entity.Staff">
|
select bs.* from basic_staff bs
|
</select>
|
|
<select id="getStaffByUserId" resultMap="staffMap">
|
select bs.*
|
from basic_staff bs
|
left join sys_user u on u.staff_id = bs."id"
|
where
|
u.user_id = #{userId}
|
</select>
|
<select id="chooseStaff" resultType="java.util.Map">
|
select id,staff_no "staffNo", staff_name "staffName"
|
from basic_staff
|
</select>
|
</mapper>
|