hn_cloud_service/realname-app/src/main/resources/mappers/own/RegistrationMapper.xml

342 lines
9.7 KiB
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.bonus.hnrn.rnama.own.dao.RegistrationDao">
<insert id="uploadJob">
insert into bns_smz_own_job_record(
<if test="workerId!=null and workerId!=''">
work_id,
</if>
<if test="gzTime!=null and gzTime!=''">
job_time,
</if>
<if test="gzUnit!=null and gzUnit!=''">
job_unit,
</if>
<if test="gzPosition!=null and gzPosition!=''">
job_name,
</if>
<if test="type!=null and type!=''">
type,
</if>
<if test="createTime!=null and createTime!=''">
crate_time,
</if>
update_time
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="gzTime!=null and gzTime!=''">
#{gzTime},
</if>
<if test="gzUnit!=null and gzUnit!=''">
#{gzUnit},
</if>
<if test="gzPosition!=null and gzPosition!=''">
#{gzPosition},
</if>
<if test="type!=null and type!=''">
#{type},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
NOW()
)
</insert>
<insert id="uploadJy">
insert into bns_smz_own_education_record(
<if test="workerId!=null and workerId!=''">
worker_id,
</if>
<if test="jyTime!=null and jyTime!=''">
education_time,
</if>
<if test="jySchool!=null and jySchool!=''">
education,
</if>
<if test="jySpeciality!=null and jySpeciality!=''">
specialized_subject,
</if>
<if test="type!=null and type!=''">
type,
</if>
<if test="createTime!=null and createTime!=''">
crate_time,
</if>
update_time
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="jyTime!=null and jyTime!=''">
#{jyTime},
</if>
<if test="jySchool!=null and jySchool!=''">
#{jySchool},
</if>
<if test="jySpeciality!=null and jySpeciality!=''">
#{jySpeciality},
</if>
<if test="type!=null and type!=''">
#{type},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
NOW()
)
</insert>
<insert id="uploadZs">
insert into bns_smz_own_worker_certificate(
<if test="workerId!=null and workerId!=''">
worker_id,
</if>
<if test="zsName!=null and zsName!=''">
name,
</if>
<if test="zsLevel!=null and zsLevel!=''">
level,
</if>
<if test="giveTime!=null and giveTime!=''">
acquisition_time,
</if>
<if test="filePath!=null and filePath!=''">
file_path,
</if>
<if test="createTime!=null and createTime!=''">
createTime,
</if>
type,
updateTime
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="zsName!=null and zsName!=''">
#{zsName},
</if>
<if test="zsLevel!=null and zsLevel!=''">
#{zsLevel},
</if>
<if test="giveTime!=null and giveTime!=''">
#{giveTime},
</if>
<if test="filePath!=null and filePath!=''">
#{filePath},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
'5',
NOW()
)
</insert>
<insert id="uploadJt">
insert into bns_smz_own_family_record(
<if test="workerId!=null and workerId!=''">
worker_id,
</if>
<if test="jtName!=null and jtName!=''">
name,
</if>
<if test="jtRelation!=null and jtRelation!=''">
relation,
</if>
<if test="jtUnit!=null and jtUnit!=''">
job_unit,
</if>
<if test="jtPhone!=null and jtPhone!=''">
phone,
</if>
<if test="type!=null and type!=''">
type,
</if>
<if test="createTime!=null and createTime!=''">
crate_time,
</if>
update_time
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="jtName!=null and jtName!=''">
#{jtName},
</if>
<if test="jtRelation!=null and jtRelation!=''">
#{jtRelation},
</if>
<if test="jtUnit!=null and jtUnit!=''">
#{jtUnit},
</if>
<if test="jtPhone!=null and jtPhone!=''">
#{jtPhone},
</if>
<if test="type!=null and type!=''">
#{type},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
NOW()
)
</insert>
<update bns_smz_id="updateWorker">
update bns_smz_own_worker set
<if test="mail!=null and mail!=''">
mail=#{mail},
</if>
<if test="zzmm!=null and zzmm!=''">
zzmm=#{zzmm},
</if>
<if test="hyzk!=null and hyzk!=''">
hyzk=#{hyzk},
</if>
<if test="nation!=null and nation!=''">
nation=#{nation},
</if>
<if test="health!=null and health!=''">
health=#{health},
</if>
<if test="address!=null and address!=''">
lxdz=#{address},
</if>
<if test="sbCard!=null and sbCard!=''">
is_sbk=#{sbCard},
</if>
<if test="ybCard!=null and ybCard!=''">
is_ybk=#{ybCard},
</if>
<if test="hkxz!=null and hkxz!=''">
hkxz=#{hkxz},
</if>
<if test="hkdz!=null and hkdz!=''">
hkdz=#{hkdz},
</if>
<if test="signPath!=null and signPath!=''">
signPath=#{signPath},
</if>
<if test="writeTime!=null and writeTime!=''">
writeTime=#{writeTime},
</if>
update_time=NOW()
where id=#{workerId}
and is_active='1'
</update>
<select id="selectRegistration" resultType="com.bonus.hnrn.rnama.own.entity.RegistrationBean">
SELECT DISTINCT ow.NAME AS userName,
ow.gw AS position,
ow.lxdh AS phone,
ow.id_number AS idNumber,
ow.hkdz,
ow.mail,
ow.zzmm,
ow.hyzk,
ow.nation,
ow.health,
ow.lxdz AS address,
ow.is_sbk AS sbCard,
ow.is_ybk AS ybCard,
di.id AS hkxz,
di.`value` AS hkxzName,
ow.signPath,
ow.writeTime,
COALESCE(gz1.job_unit, '') AS gzUnitOne,
COALESCE(gz1.job_time, '') AS gzTimeOne,
COALESCE(gz1.job_name, '') AS gzPositionOne,
COALESCE(gz2.job_unit, '') AS gzUnitTwo,
COALESCE(gz2.job_time, '') AS gzTimeTwo,
COALESCE(gz2.job_name, '') AS gzPositionTwo,
COALESCE(gz3.job_unit, '') AS gzUnitThree,
COALESCE(gz3.job_time, '') AS gzTimeThree,
COALESCE(gz3.job_name, '') AS gzPositionThree,
COALESCE(jy1.education_time, '') AS jyTimeOne,
COALESCE(jy1.education, '') AS jySchoolOne,
COALESCE(jy1.specialized_subject, '') AS jySpecialityOne,
COALESCE(jy2.education_time, '') AS jyTimeTwo,
COALESCE(jy2.education, '') AS jySchoolTwo,
COALESCE(jy2.specialized_subject, '') AS jySpecialityTwo,
COALESCE(jy3.education_time, '') AS jyTimeThree,
COALESCE(jy3.education, '') AS jySchoolThree,
COALESCE(jy3.specialized_subject, '') AS jySpecialityThree,
COALESCE(zs.`name`, '') AS zsName,
COALESCE(zs.`level`, '') AS zsLevel,
COALESCE(zs.acquisition_time, '') AS giveTime,
COALESCE(zs.file_path, '') AS filePath,
COALESCE(jt1.`name`, '') AS jtNameOne,
COALESCE(jt1.relation, '') AS jtRelationOne,
COALESCE(jt1.job_unit, '') AS jtUnitOne,
COALESCE(jt1.phone, '') AS jtPhoneOne,
COALESCE(jt2.`name`, '') AS jtNameTwo,
COALESCE(jt2.relation, '') AS jtRelationTwo,
COALESCE(jt2.job_unit, '') AS jtUnitTwo,
COALESCE(jt2.phone, '') AS jtPhoneTwo,
COALESCE(jt3.`name`, '') AS jtNameThree,
COALESCE(jt3.relation, '') AS jtRelationThree,
COALESCE(jt3.job_unit, '') AS jtUnitThree,
COALESCE(jt3.phone, '') AS jtPhoneThree
FROM bns_smz_own_worker ow
LEFT JOIN bns_smz_own_job_record gz1 ON gz1.work_id = ow.id
AND gz1.type = '1'
AND gz1.is_active = '1'
LEFT JOIN bns_smz_own_job_record gz2 ON gz2.work_id = ow.id
AND gz2.type = '2'
AND gz2.is_active = '1'
LEFT JOIN bns_smz_own_job_record gz3 ON gz3.work_id = ow.id
AND gz3.type = '3'
AND gz3.is_active = '1'
LEFT JOIN bns_smz_own_education_record jy1 ON jy1.worker_id = ow.id
AND jy1.type = '1'
AND jy1.is_active = '1'
LEFT JOIN bns_smz_own_education_record jy2 ON jy2.worker_id = ow.id
AND jy2.type = '2'
AND jy2.is_active = '1'
LEFT JOIN bns_smz_own_education_record jy3 ON jy3.worker_id = ow.id
AND jy3.type = '3'
AND jy3.is_active = '1'
LEFT JOIN bns_smz_own_worker_certificate zs ON zs.worker_id = ow.id
AND zs.type = '5'
AND zs.is_active = '1'
LEFT JOIN bns_smz_own_family_record jt1 ON jt1.worker_id = ow.id
AND jt1.type = '1'
AND jt1.is_active = '1'
LEFT JOIN bns_smz_own_family_record jt2 ON jt2.worker_id = ow.id
AND jt2.type = '2'
AND jt2.is_active = '1'
LEFT JOIN bns_smz_own_family_record jt3 ON jt3.worker_id = ow.id
AND jt3.type = '3'
AND jt3.is_active = '1'
LEFT JOIN bns_smz_own_dict di on di.id=ow.hkxz and di.is_active='1'
WHERE ow.is_active = '1'
AND ow.id = #{workerId}
LIMIT 1
</select>
<select id="getRegistrationData" resultType="com.bonus.hnrn.rnama.own.entity.RegistrationBean">
SELECT ow.id,
ow.gw AS position,
di.id as hkxz,
di.`value` AS hkxzName,
ow.hkdz AS address
FROM bns_smz_own_worker ow
LEFT JOIN bns_smz_own_dict di ON ow.hkxz = di.id
AND di.is_active = '1'
WHERE ow.id = #{workerId}
and ow.is_active = '1'
</select>
<select id="getHkxzSp" resultType="com.bonus.hnrn.rnama.own.entity.RegistrationBean">
SELECT
dic.id AS hkxz,
dic.`value` AS hkxzName
FROM bns_smz_own_dict di
LEFT JOIN bns_smz_own_dict dic ON di.id = dic.parentId
AND dic.is_active = '1'
WHERE
di.type = 'hkxz'
AND di.is_active = '1'
</select>
</mapper>