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

159 lines
3.5 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.OwnFirstDao">
<insert id="uploadWorkPhoto">
insert into bns_smz_own_worker_certificate(
<if test="workerId!=null and workerId!=''">
worker_id,
</if>
<if test="fileName!=null and fileName!=''">
name,
</if>
<if test="filePath!=null and filePath!=''">
file_path,
</if>
<if test="type!=null and type!=''">
type,
</if>
<if test="faceFeature!=null and faceFeature!=''">
face_features,
</if>
<if test="createTime!=null and createTime!=''">
createTime,
</if>
updateTime,
is_active
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="fileName!=null and fileName!=''">
#{fileName},
</if>
<if test="filePath!=null and filePath!=''">
#{filePath},
</if>
<if test="type!=null and type!=''">
#{type},
</if>
<if test="faceFeature!=null and faceFeature!=''">
#{faceFeature},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
NOW(),
1
)
</insert>
<insert id="faceApply">
insert into bns_smz_own_worker_certificate_record(
<if test="workerId!=null and workerId!=''">
worker_id,
</if>
<if test="userName!=null and userName!=''">
name,
</if>
<if test="idNumber!=null and idNumber!=''">
id_number,
</if>
<if test="facePath!=null and facePath!=''">
file_path,
</if>
<if test="faceFeature!=null and faceFeature!=''">
face_features,
</if>
<if test="createTime!=null and createTime!=''">
createTime,
</if>
state,
updateTime,
is_active
)
values (
<if test="workerId!=null and workerId!=''">
#{workerId},
</if>
<if test="userName!=null and userName!=''">
#{userName},
</if>
<if test="idNumber!=null and idNumber!=''">
#{idNumber},
</if>
<if test="facePath!=null and facePath!=''">
#{facePath},
</if>
<if test="faceFeature!=null and faceFeature!=''">
#{faceFeature},
</if>
<if test="createTime!=null and createTime!=''">
#{createTime},
</if>
'0',
NOW(),
1
)
</insert>
<update id="updatePro">
update bns_smz_own_worker
set pro_id=#{proId}
where id = #{workerId}
and is_active = '1'
</update>
<update id="updateUser">
update bns_smz_sys_user
set PRO_ID=#{proId},
face_photo=#{facePath},
face_feature=#{faceFeature}
where id = #{id}
and is_active = '1'
</update>
<update id="modifyPro">
update bns_smz_own_worker
set pro_id=#{proId}
where id = #{workerId}
and is_active = '1'
</update>
<update id="modifyProByUser">
update bns_smz_sys_user
set PRO_ID=#{proId}
where id = #{id}
and is_active = '1'
</update>
<select id="getOwnPro" resultType="com.bonus.hnrn.rnama.own.entity.OwnFirstBean">
SELECT
pro.id AS proId,
pro.`name` AS proName
FROM bns_smz_bm_project pro
WHERE
pro.company_id IN (
SELECT
org.id
FROM bns_smz_own_worker ow
LEFT JOIN bns_smz_pm_organization org ON org.PARENT_ID = ow.ygdw
WHERE
ow.id = #{workerId}
AND org.is_active = '1'
AND ow.is_active = '1'
)
AND pro.is_active = '1'
<if test="keyword!=null and keyword!=''">
and pro.`name` like concat('%',#{keyword},'%')
</if>
</select>
<select id="selectIsApply" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM bns_smz_own_worker_certificate_record
WHERE
is_active = '1'
AND worker_id =#{workerId}
AND state = '0'
</select>
</mapper>