123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809 |
- <?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.jeeplus.modules.workstaff.dao.WorkStaffAchivesDao">
-
- <sql id="workStaffBasicInfoColumns">
- a.id AS "id",
- a.create_by AS "createBy.id",
- a.create_date AS "createDate",
- a.update_by AS "updateBy.id",
- a.update_date AS "updateDate",
- a.remarks AS "remarks",
- a.del_flag AS "delFlag",
- a.office_id AS "office.id",
- a.company_id AS "company.id",
- a.no AS "no",
- a.dimission_date AS "dimissionDate",
- a.workEnd_date AS "workEndDate",
- a.name AS "name",
- a.gender AS "gender",
- a.nation AS "nation",
- a.id_card AS "idCard",
- a.age AS "age",
- a.birthday AS "birthday",
- a.calendar AS "calendar",
- a.email AS "email",
- a.mobile AS "mobile",
- a.phone AS "phone",
- a.marriage AS "marriage",
- a.politics AS "politics",
- a.ex_soldier AS "exSoldier",
- a.address AS "address",
- a.native_place AS "nativePlace.id",
- a.household AS "household",
- a.duty AS "duty",
- a.job_grade AS "jobGrade.id",
- a.status AS "status",
- a.entry_date AS "entryDate",
- a.work_date AS "workDate",
- a.bank_name AS "bankName",
- a.bank_card AS "bankCard",
- a.industry_date AS "industryDate",
- a.ts AS "ts",
- a.picture AS "picture",
- o.top_company AS "office.name",
- o.top_company AS "office.topCompany",
- a.user_id AS "userId",
- a.branch_office AS "branchOffice.id",
- branch.name AS "branchOffice.name",
- s.name AS "company.name",
- jg.name AS "jobGrade.name",
- jg.pay AS "salary",
- nativePlace.name AS "nativePlace.name",
- a.percent AS "percent",
- a.try_end_time AS "tryEndTime"
- </sql>
-
- <sql id="workStaffBasicInfoJoins">
- LEFT JOIN sys_office o ON o.id = a.office_id
- LEFT JOIN sys_office branch ON branch.id = a.branch_office
- LEFT JOIN sys_office s ON s.id = a.company_id
- LEFT JOIN sys_user u ON u.id = a.create_by
- LEFT JOIN sys_area nativePlace ON nativePlace.id = a.native_place
- LEFT JOIN work_job_grade jg ON jg.id = a.job_grade
- </sql>
- <select id="get" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="getByUserId" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE a.user_id = #{id}
- </select>
-
- <select id="findList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="company != null and company.id != null and company.id != ''">
- AND a.company_id = #{company.id}
- </if>
- <if test="office != null and office.id != null and office.id != ''">
- AND a.office_id = #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="idCard != null and idCard != ''">
- AND a.id_card = #{idCard}
- </if>
- <if test="mobile != null and mobile != ''">
- AND a.mobile = #{mobile}
- </if>
- <if test="jobGrade != null and jobGrade.id !=null and jobGrade.id != ''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="beginEntryDate != null">
- AND a.entry_date >= #{beginEntryDate}
- </if>
- <if test="endEntryDate != null">
- AND a.entry_date <= #{endEntryDate}
- </if>
- <if test="minAge != null">
- AND a.age >= #{minAge}
- </if>
- <if test="maxAge != null">
- AND a.age <= #{maxAge}
- </if>
- <if test="nation != null and nation !=''">
- AND a.nation = #{nation}
- </if>
- <if test="calendar != null and calendar !=''">
- AND a.calendar = #{calendar}
- </if>
- <if test="gender != null and gender !=''">
- AND a.gender = #{gender}
- </if>
- <if test="marriage != null and marriage !=''">
- AND a.marriage = #{marriage}
- </if>
- <if test="politics != null and politics !=''">
- AND a.politics = #{politics}
- </if>
- <if test="minSalary != null">
- AND jg.pay >= #{minSalary}
- </if>
- <if test="maxSalary != null">
- AND jg.pay <= #{maxSalary}
- </if>
- <if test="beginWorkDate != null">
- AND a.work_date >= #{beginWorkDate}
- </if>
- <if test="endWorkDate != null">
- AND a.work_date <= #{endWorkDate}
- </if>
- <if test="beginBirthdayDate != null">
- AND a.birthday >= #{beginBirthdayDate}
- </if>
- <if test="endBirthdayDate != null">
- AND a.birthday <= #{endBirthdayDate}
- </if>
- <if test="minPercent != null and minPercent !=''">
- AND a.percent >= #{minPercent}
- </if>
- <if test="maxPercent != null and maxPercent!=''">
- AND a.percent <= #{maxPercent}
- </if>
- <if test="sqlMap.dsf !=null and sqlMap.dsf !=''">
- AND ((a.user_id = #{currentUser.id} AND a.branch_office = #{currentUser.branchOffice.id})${sqlMap.dsf} )
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.entry_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findListByRoleList" resultType="WorkStaffBasicInfo">
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- LEFT JOIN sys_user_role ur ON ur.user_id = a.user_id
- LEFT JOIN sys_role r ON ur.role_id = r.id
- WHERE
- a.del_flag = #{DEL_FLAG_NORMAL} AND r.id = #{roleId} AND `status` IN ('试用','正式','劳务')
- <if test="company != null and company.id != null and company.id != ''">
- AND a.company_id = #{company.id}
- </if>
- <if test="office != null and office.id != null and office.id != ''">
- AND a.office_id = #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="idCard != null and idCard != ''">
- AND a.id_card = #{idCard}
- </if>
- <if test="mobile != null and mobile != ''">
- AND a.mobile = #{mobile}
- </if>
- <if test="jobGrade != null and jobGrade.id !=null and jobGrade.id != ''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="beginEntryDate != null">
- AND a.entry_date >= #{beginEntryDate}
- </if>
- <if test="endEntryDate != null">
- AND a.entry_date <= #{endEntryDate}
- </if>
- <if test="achiveId != null and achiveId !=''">
- AND a.achive_id = #{achiveId}
- </if>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="getByCompany" resultType="java.lang.Integer" >
- select count(*) FROM work_staff_achives
- where
- user_id = #{userId}
- AND company_id = #{company.id}
- AND `status` IN ('试用','正式','劳务')
- AND del_flag = '0'
- </select>
- <select id="getByBranchCompany" resultType="java.lang.Integer" >
- select count(*) FROM work_staff_achives
- where
- user_id = #{userId}
- AND branch_office = #{branchOffice.id}
- AND `status` IN ('试用','正式','劳务')
- AND del_flag = '0'
- </select>
- <select id="getByCompanyInfo" resultType="WorkStaffBasicInfo" >
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- where
- a.user_id = #{userId}
- AND a.company_id = #{company.id}
- AND a.`status` IN ('试用','正式','劳务')
- AND a.del_flag = '0'
- </select>
- <select id="getAllListInfo" resultType="WorkStaffBasicInfo" >
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- where
- a.`status` IN ('试用','正式','劳务')
- AND a.del_flag = '0'
- </select>
- <select id="getByUserOffice" resultType="WorkStaffBasicInfo" >
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- where
- a.user_id = #{userId}
- AND a.office_id = #{office.id}
- AND a.`status` IN ('试用','正式','劳务')
- AND a.del_flag = '0'
- </select>
- <select id="getByOffice" resultType="WorkStaffBasicInfo" >
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- where
- AND a.office_id = #{office.id}
- AND a.`status` IN ('试用','正式','劳务')
- AND a.del_flag = '0'
- </select>
- <select id="getByNoName" resultType="WorkStaffBasicInfo" >
- select
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- where
- a.no = #{no}
- AND a.name = #{name}
- AND a.company_id = #{company.id}
- AND a.`status` IN ('试用','正式','劳务')
- AND a.del_flag = '0'
- </select>
- <select id="findAllList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.update_date DESC
- </otherwise>
- </choose>
- </select>
- <select id="findInfoList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = '0'
- AND a.`status` IN ('试用','正式','劳务')
- </where>
- </select>
- <insert id="insert">
- INSERT INTO work_staff_achives(
- id,
- create_by,
- create_date,
- update_by,
- update_date,
- remarks,
- del_flag,
- office_id,
- company_id,
- no,
- name,
- dimission_date,
- workEnd_date,
- gender,
- nation,
- id_card,
- age,
- birthday,
- calendar,
- email,
- mobile,
- marriage,
- politics,
- ex_soldier,
- address,
- native_place,
- household,
- duty,
- job_grade,
- status,
- entry_date,
- work_date,
- bank_name,
- bank_card,
- industry_date,
- ts,
- picture,
- user_id,
- branch_office,
- percent,
- try_end_time
- ) VALUES (
- #{id},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{remarks},
- #{delFlag},
- #{office.id},
- #{company.id},
- #{no},
- #{name},
- #{dimissionDate},
- #{workEndDate},
- #{gender},
- #{nation},
- #{idCard},
- #{age},
- #{birthday},
- #{calendar},
- #{email},
- #{mobile},
- #{marriage},
- #{politics},
- #{exSoldier},
- #{address},
- #{nativePlace.id},
- #{household},
- #{duty},
- #{jobGrade.id},
- #{status},
- #{entryDate},
- #{workDate},
- #{bankName},
- #{bankCard},
- #{industryDate},
- #{ts},
- #{picture},
- #{userId},
- #{branchOffice.id},
- #{percent},
- #{tryEndTime}
- )
- </insert>
-
- <update id="update">
- UPDATE work_staff_achives SET
- update_by = #{updateBy.id},
- update_date = #{updateDate},
- remarks = #{remarks},
- office_id = #{office.id},
- company_id = #{company.id},
- no = #{no},
- name = #{name},
- dimission_date= #{dimissionDate},
- workEnd_date = #{workEndDate},
- gender = #{gender},
- nation = #{nation},
- id_card = #{idCard},
- age = #{age},
- birthday = #{birthday},
- calendar = #{calendar},
- email = #{email},
- mobile = #{mobile},
- marriage = #{marriage},
- politics = #{politics},
- ex_soldier = #{exSoldier},
- address = #{address},
- native_place = #{nativePlace.id},
- household = #{household},
- duty = #{duty},
- job_grade = #{jobGrade.id},
- status = #{status},
- entry_date = #{entryDate},
- work_date = #{workDate},
- bank_name = #{bankName},
- bank_card = #{bankCard},
- industry_date = #{industryDate},
- ts = #{ts},
- picture = #{picture},
- user_id = #{userId},
- branch_office = #{branchOffice.id},
- percent = #{percent},
- try_end_time = #{tryEndTime}
- WHERE id = #{id}
- </update>
-
-
- <!--物理删除-->
- <update id="delete">
- DELETE FROM work_staff_achives
- WHERE id = #{id}
- </update>
-
- <!--逻辑删除-->
- <update id="deleteByLogic">
- UPDATE work_staff_achives SET
- del_flag = #{DEL_FLAG_DELETE}
- WHERE id = #{id}
- </update>
-
- <!-- 根据实体名称和字段名称和字段值获取唯一记录 -->
- <select id="findUniqueByProperty" resultType="WorkStaffBasicInfo" statementType="STATEMENT">
- select * FROM work_staff_achives where ${propertyName} = '${value}'
- </select>
- <!--根据userId获取入职信息-->
- <select id="getWorkStaffBasicInfo" resultType="WorkStaffBasicInfo" parameterType="java.lang.String">
- select a.* ,
- o.top_company as "office.name",
- o.id as "office.id",
- jg.name AS "jobGrade.name",
- jg.id AS "jobGrade.id",
- jg.pay AS "salary",
- DATE_FORMAT(a.entry_date, '%Y-%m-%d') as entry_date,
- (select DATE_FORMAT(MAX(r.try_end_time), '%Y-%m-%d') from work_relationship r where r.staff_info_id=#{id}) tryEndTime
- FROM work_staff_achives a
- LEFT JOIN sys_office o on o.id=a.office_id
- LEFT JOIN work_job_grade jg ON jg.id = a.job_grade
- where a.id=#{id}
- </select>
- <select id="queryMaxNoWithCompany" resultType="String">
- SELECT max(SUBSTR(no,2)+0) FROM work_staff_achives where branch_office=#{branchOffice.id} and del_flag='0'
- </select>
- <select id="findUserList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="office != null and office.id != null and office.id !=''">
- AND a.office_id= #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="gender != null and gender != ''">
- AND a.gender = #{gender}
- </if>
- <if test="jobGrade != null and jobGrade.id != null and jobGrade.id !=''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="branchOffice != null and branchOffice.id != null and branchOffice.id != ''">
- AND a.branch_office = #{branchOffice.id}
- </if>
- <if test="sqlStr != null and sqlStr != ''">
- ${sqlStr}
- </if>
- </where>
- </select>
- <select id="findUserApplyList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="office != null and office.id != null and office.id !=''">
- AND a.office_id= #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="gender != null and gender != ''">
- AND a.gender = #{gender}
- </if>
- <if test="jobGrade != null and jobGrade.id != null and jobGrade.id !=''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="branchOffice != null and branchOffice.id != null and branchOffice.id != ''">
- AND a.branch_office = #{branchOffice.id}
- </if>
- and a.id not in (select r.basic_info_id from work_regular_apply r where r.state !='5' and r.del_flag !='1')
- </where>
- </select>
- <select id="findUserShipList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="office != null and office.id != null and office.id !=''">
- AND a.office_id= #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="userId != null and userId != ''">
- AND a.user_id = #{userId}
- </if>
- <if test="gender != null and gender != ''">
- AND a.gender = #{gender}
- </if>
- <if test="jobGrade != null and jobGrade.id != null and jobGrade.id !=''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="branchOffice != null and branchOffice.id != null and branchOffice.id != ''">
- AND a.branch_office = #{branchOffice.id}
- </if>
- and a.id not in (select r.staff_info_id from work_relationship r where r.status !='5' and r.del_flag !='1')
- AND a.status in ('正式','试用','劳务')
- </where>
- </select>
- <select id="findListByIdCard" resultType="WorkStaffBasicInfo">
- SELECT
- a.*
- FROM work_staff_achives a
- <where>
- a.del_flag = #{DEL_FLAG_NORMAL}
- <if test="company != null and company.id != null and company.id != ''">
- AND a.company_id = #{company.id}
- </if>
- <if test="idCard != null and idCard != ''">
- AND a.id_card = #{idCard}
- </if>
- </where>
- ORDER BY a.entry_date DESC
- </select>
- <update id="updatePercent">
- UPDATE work_staff_achives SET percent=#{percent} WHERE id=#{id}
- </update>
- <select id="findTaskUserList" resultType="WorkStaffBasicInfo" >
- SELECT * FROM
- work_staff_achives a
- WHERE
- a.del_flag=0
- and a.`status` = '试用'
- and date_add(DATE_FORMAT(now(), '%Y-%m-%d'), interval #{day} day)=DATE_FORMAT(a.try_end_time, '%Y-%m-%d')
- AND a.id NOT IN (SELECT r.basic_info_id FROM work_regular_apply r WHERE r.del_flag = '0')
- and a.branch_office=#{branchOffice}
- </select>
- <select id="findUserInfoExcel" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE a.name=#{name}
- and a.no=#{no}
- </select>
- <select id="findTemplateUser" resultType="WorkStaffBasicInfo" >
- select
- u.id as "userId",
- u.name as "name",
- a.no,
- a.gender,
- o.name as "office.name",
- o.top_company as "office.topCompany",
- jg.name as "jobGrade.name"
- from sys_user u
- left join work_staff_achives a on u.id=a.user_id
- left join sys_office o on o.id=u.office_id
- LEFT JOIN work_job_grade jg ON jg.id = a.job_grade
- <where>
- u.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND u.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="office != null and office.id != null and office.id !=''">
- AND u.office_id= #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="gender != null and gender != ''">
- AND a.gender = #{gender}
- </if>
- <if test="jobGrade != null and jobGrade.id != null and jobGrade.id !=''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <choose>
- <when test="branchOffice != null and branchOffice.id != null and branchOffice.id != ''">
- and u.office_id in (select off.id from sys_office off where off.branch_office=#{branchOffice.id})
- </when>
- <otherwise>
- and u.office_id in
- (select off.id from sys_office off where off.parent_ids like concat('%',#{company.id},'%') and off.type=2 and (off.branch_office is null or off.branch_office=''))
- </otherwise>
- </choose>
- </where>
- </select>
- <select id="sysWarningUser" resultType="WorkStaffBasicInfo" >
- select
- u.id as "userId",
- u.name as "name",
- a.no,
- a.gender,
- o.name as "office.name",
- o.top_company as "office.topCompany",
- jg.name as "jobGrade.name"
- from sys_user u
- left join work_staff_achives a on u.id=a.user_id
- left join sys_office o on o.id=u.office_id
- LEFT JOIN work_job_grade jg ON jg.id = a.job_grade
- <where>
- u.del_flag = #{DEL_FLAG_NORMAL}
- <if test="name != null and name != ''">
- AND u.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="office != null and office.id != null and office.id !=''">
- AND u.office_id= #{office.id}
- </if>
- <if test="no != null and no != ''">
- AND a.no = #{no}
- </if>
- <if test="gender != null and gender != ''">
- AND a.gender = #{gender}
- </if>
- <if test="jobGrade != null and jobGrade.id != null and jobGrade.id !=''">
- AND a.job_grade = #{jobGrade.id}
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- and u.company_id=#{company.id}
- </where>
- </select>
- <select id="countByNo" resultType="int">
- SELECT count(*) from work_staff_achives a WHERE a.no = #{no} and a.company_id = #{company.id} and del_flag = '0'
- </select>
- <select id="findTaskBranchList" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM
- work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE
- a.del_flag=0
- and a.status = #{status}
- and a.branch_office is not null
- AND a.id NOT IN (SELECT r.basic_info_id FROM work_regular_apply r WHERE r.del_flag = '0')
- group by a.branch_office
- </select>
- <!--当前登录人获取档案-->
- <select id="getBasicInfo" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE a.user_id = #{userId} and a.company_id=#{company.id} and a.status not in ('离职','退休')
- </select>
- <select id="getJob" resultType="WorkStaffBasicInfo" >
- SELECT
- <include refid="workStaffBasicInfoColumns"/>
- FROM work_staff_achives a
- <include refid="workStaffBasicInfoJoins"/>
- WHERE a.user_id = #{userId} limit 1
- </select>
- <update id="updateStatus">
- update work_staff_achives set
- status = #{status}
- where user_id = #{id}
- </update>
- <!-- 我的信息-修改用户的四个属性,同步到user,achieves,basicInfo-->
- <update id="updateWorkStaffAchieves" parameterType="WorkStaffBasicInfo">
- update work_staff_achives
- <set>
- <if test="name != null and name != ''">
- name = #{name},
- </if>
- <if test="email != null and email != ''">
- email = #{email},
- </if>
- <if test="phone != null and phone != ''">
- phone = #{phone},
- </if>
- <if test="remarks != null and remarks != ''">
- remarks = #{remarks}
- </if>
- </set>
- where user_id = #{userId}
- </update>
- </mapper>
|