421 lines
24 KiB
XML
421 lines
24 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.canteen.core.certificate.mapper.CertificateManageMapper">
|
||
|
|
|
||
|
|
<select id="selectCertificateInfoList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday,bc.issue_lifespan as issuelifespan
|
||
|
|
,bc.is_ele as isele,sd.dept_name as deptname,sd.dept_full_name as deptfullName ,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||
|
|
,bc.state,case
|
||
|
|
when bc.state='0' then '未上交'
|
||
|
|
when bc.state='1' then '存入中'
|
||
|
|
when bc.state='2' then '已存入'
|
||
|
|
when bc.state='3' then '取出中'
|
||
|
|
when bc.state='4' then '已取出'
|
||
|
|
end as statename,bc.create_time as createtime
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
where bc.del_flag='0'
|
||
|
|
<if test="idNumber != null and idNumber != ''">
|
||
|
|
and bc.id_number like concat('%', #{idNumber}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
and bc.name like concat('%', #{name}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="certificateNo != null and certificateNo != ''">
|
||
|
|
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="keyWord != null and keyWord != ''">
|
||
|
|
and (bc.certificate_no like concat('%', #{keyWord}, '%') or bc.name like concat('%', #{name}, '%')
|
||
|
|
or bc.id_number like concat('%', #{idNumber}, '%')
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
<if test='isAdmin != null and isAdmin == "1"'>
|
||
|
|
and bc.dept_id in (
|
||
|
|
select dept_id from sys_dept where dept_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId}))
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})))
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
order by bc.update_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCertificateInfoByCertificateNo" parameterType="Long" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday
|
||
|
|
,bc.issue_lifespan as issuelifespan,bc.is_ele as isele,sd.dept_name as deptname
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
where di.certificate_no = #{certificateNo}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertCertificateInfo" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" >
|
||
|
|
insert into basic_certificate
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="deptId != null and deptId != ''">dept_id,</if>
|
||
|
|
<if test="name != null">name,</if>
|
||
|
|
<if test="idNumber != null">id_number,</if>
|
||
|
|
<if test="phone != null">phone,</if>
|
||
|
|
<if test="birthday != null">birthday,</if>
|
||
|
|
<if test="birthAddr != null">birth_addr,</if>
|
||
|
|
<if test="certificateType != null">certificate_type,</if>
|
||
|
|
<if test="certificateNo != null">certificate_no,</if>
|
||
|
|
<if test="issueAddr != null">issue_addr,</if>
|
||
|
|
<if test="issueDay != null">issue_day,</if>
|
||
|
|
<if test="issueLifespan != null">issue_lifespan,</if>
|
||
|
|
<if test="isEle != null and isEle != ''">is_ele,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
<if test="updateTime != null">update_time,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="deptId != null and deptId != ''"> #{deptId} ,</if>
|
||
|
|
<if test="name != null"> #{name} ,</if>
|
||
|
|
<if test="idNumber != null"> #{idNumber} ,</if>
|
||
|
|
<if test="phone != null"> #{phone} ,</if>
|
||
|
|
<if test="birthday != null"> #{birthday} ,</if>
|
||
|
|
<if test="birthAddr != null"> #{birthAddr} ,</if>
|
||
|
|
<if test="certificateType != null"> #{certificateType} ,</if>
|
||
|
|
<if test="certificateNo != null"> #{certificateNo} ,</if>
|
||
|
|
<if test="issueAddr != null"> #{issueAddr} ,</if>
|
||
|
|
<if test="issueDay != null"> #{issueDay} ,</if>
|
||
|
|
<if test="issueLifespan != null"> #{issueLifespan} ,</if>
|
||
|
|
<if test="isEle != null and isEle != ''"> #{isEle} ,</if>
|
||
|
|
<if test="createBy != null"> #{createBy} ,</if>
|
||
|
|
<if test="createTime != null"> #{createTime} ,</if>
|
||
|
|
<if test="updateBy != null"> #{updateBy} ,</if>
|
||
|
|
<if test="updateTime != null"> #{updateTime} ,</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<select id="getUserByIdNumber" resultType="java.lang.Integer">
|
||
|
|
select count(1) from sys_user
|
||
|
|
where del_flag='0'
|
||
|
|
<if test="phone != null and phone!='' ">
|
||
|
|
and phonenumber=#{phone}
|
||
|
|
</if>
|
||
|
|
<if test="idNumber != null and idNumber!='' ">
|
||
|
|
and id_number=#{idNumber}
|
||
|
|
</if>
|
||
|
|
<if test="userName != null and userName!='' ">
|
||
|
|
and user_name=#{userName}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
<insert id="insertUserInfo" parameterType="com.bonus.canteen.core.certificate.vo.UserInfo" keyProperty="userId" useGeneratedKeys="true">
|
||
|
|
insert into sys_user
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="deptId != null and deptId != ''">dept_id,</if>
|
||
|
|
<if test="userName != null">user_name,</if>
|
||
|
|
<if test="userCode != null">user_code,</if>
|
||
|
|
<if test="nickName != null">nick_name,</if>
|
||
|
|
<if test="userType != null">user_type,</if>
|
||
|
|
<if test="phonenumber != null">phonenumber,</if>
|
||
|
|
<if test="sex != null">sex,</if>
|
||
|
|
<if test="password != null">password,</if>
|
||
|
|
<if test="status != null">status,</if>
|
||
|
|
<if test="loginType != null">login_type,</if>
|
||
|
|
<if test="delFlag != null">del_flag,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="deptId != null and deptId != ''"> #{deptId} ,</if>
|
||
|
|
<if test="userName != null"> #{userName} ,</if>
|
||
|
|
<if test="userCode != null">#{userCode} ,</if>
|
||
|
|
<if test="nickName != null"> #{nickName} ,</if>
|
||
|
|
<if test="userType != null"> #{userType} ,</if>
|
||
|
|
<if test="phonenumber != null"> #{phonenumber} ,</if>
|
||
|
|
<if test="sex != null"> #{sex} ,</if>
|
||
|
|
<if test="password != null"> #{password} ,</if>
|
||
|
|
<if test="status != null"> #{status} ,</if>
|
||
|
|
<if test="loginType != null"> #{loginType} ,</if>
|
||
|
|
<if test="delFlag != null"> #{delFlag} ,</if>
|
||
|
|
<if test="createBy != null"> #{createBy} ,</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<insert id="insertUserRole" parameterType="com.bonus.canteen.core.certificate.vo.UserInfo" >
|
||
|
|
insert into sys_user_role
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="userId != null and userId != ''">user_id,</if>
|
||
|
|
<if test="roleId != null">role_id,</if>
|
||
|
|
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="userId != null and userId != ''"> #{userId} ,</if>
|
||
|
|
<if test="roleId != null"> #{roleId} ,</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
<update id="insertCertificateInfoMerrge" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
INSERT INTO basic_certificate (
|
||
|
|
dept_id ,
|
||
|
|
name ,
|
||
|
|
id_number ,
|
||
|
|
birthday ,
|
||
|
|
birth_addr ,
|
||
|
|
certificate_type ,
|
||
|
|
certificate_no ,
|
||
|
|
issue_addr ,
|
||
|
|
issue_day ,
|
||
|
|
issue_lifespan ,
|
||
|
|
is_ele ,
|
||
|
|
state ,
|
||
|
|
del_flag ,
|
||
|
|
create_by ,
|
||
|
|
update_time ,
|
||
|
|
update_by
|
||
|
|
)
|
||
|
|
VALUES (
|
||
|
|
#{deptId} ,
|
||
|
|
#{name} ,
|
||
|
|
#{idNumber} ,
|
||
|
|
#{birthday} ,
|
||
|
|
#{birthAddr} ,
|
||
|
|
#{certificateType} ,
|
||
|
|
#{certificateNo} ,
|
||
|
|
#{issueAddr} ,
|
||
|
|
#{issueDay} ,
|
||
|
|
#{issueLifespan} ,
|
||
|
|
#{isEle} ,
|
||
|
|
#{state} ,
|
||
|
|
#{delFlag} ,
|
||
|
|
#{createBy} ,
|
||
|
|
#{updateBy} ,
|
||
|
|
#{updateTime}
|
||
|
|
)
|
||
|
|
ON DUPLICATE KEY UPDATE
|
||
|
|
dept_id =#{deptId} ,
|
||
|
|
name =#{name} ,
|
||
|
|
id_number =#{idNumber} ,
|
||
|
|
birthday =#{birthday} ,
|
||
|
|
birth_addr =#{birthAddr} ,
|
||
|
|
certificate_type =#{certificateType} ,
|
||
|
|
issue_addr =#{issueAddr} ,
|
||
|
|
issue_day =#{issueDay} ,
|
||
|
|
issue_lifespan =#{issueLifespan} ,
|
||
|
|
is_ele =#{isEle} ,
|
||
|
|
del_flag =#{delFlag} ,
|
||
|
|
update_time =#{updateTime} ,
|
||
|
|
update_by =#{updateBy}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateCertificateInfo" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
update basic_certificate
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
|
||
|
|
<if test="name != null">name = #{name},</if>
|
||
|
|
<if test="birthday != null">birthday = #{birthday},</if>
|
||
|
|
<if test="birthAddr != null">birth_addr = #{birthAddr},</if>
|
||
|
|
<if test="certificateType != null">certificate_type = #{certificateType},</if>
|
||
|
|
<if test="certificateNo != null">certificate_no = #{certificateNo},</if>
|
||
|
|
<if test="idNumber != null">id_number = #{idNumber},</if>
|
||
|
|
<if test="phone != null">phone = #{phone},</if>
|
||
|
|
<if test="issueAddr != null">issue_addr = #{issueAddr},</if>
|
||
|
|
<if test="issueDay != null">issue_day = #{issueDay},</if>
|
||
|
|
<if test="issueLifespan != null">issue_lifespan = #{issueLifespan},</if>
|
||
|
|
<if test="isEle != null and isEle != ''">is_ele = #{isEle},</if>
|
||
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
<if test="userId != null">user_id = #{userId},</if>
|
||
|
|
</trim>
|
||
|
|
where certificate_no = #{certificateNo}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteCertificateInfoByCertificateNos" parameterType="String">
|
||
|
|
delete from basic_certificate where certificate_No in
|
||
|
|
<foreach item="certificateNo" collection="certificateNos" open="(" separator="," close=")">
|
||
|
|
#{certificateNo}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="getCertificateTaskByCertificateNos" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday,bc.issue_lifespan as issuelifespan
|
||
|
|
,bc.is_ele as isele,sd.dept_name as deptname,sd.dept_full_name as deptfullName ,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||
|
|
,bc.state,case
|
||
|
|
when bc.state='0' then '未上交'
|
||
|
|
when bc.state='1' then '存入中'
|
||
|
|
when bc.state='2' then '已存入'
|
||
|
|
when bc.state='3' then '取出中'
|
||
|
|
when bc.state='4' then '已取出'
|
||
|
|
end as statename
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
where bc.del_flag='0' and bc.state in ('1','2','3')
|
||
|
|
and bc.certificate_No in
|
||
|
|
<foreach item="certificateNo" collection="certificateNos" open="(" separator="," close=")">
|
||
|
|
#{certificateNo}
|
||
|
|
</foreach>
|
||
|
|
group by bc.certificate_No
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<delete id="deleteCertificateTaskByCertificateNos">
|
||
|
|
delete from basic_certificate_task where certificate_No in
|
||
|
|
<foreach item="certificateNo" collection="certificateNos" open="(" separator="," close=")">
|
||
|
|
#{certificateNo}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="selectCertificateRecordList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateRecord" resultType="com.bonus.canteen.core.certificate.vo.CertificateRecord">
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday,bc.issue_lifespan as issuelifespan
|
||
|
|
,bc.is_ele as isele,sd.dept_name as deptname,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||
|
|
,bc.state,case
|
||
|
|
when bc.state='0' then '未上交'
|
||
|
|
when bc.state='1' then '未执行'
|
||
|
|
when bc.state='2' then '已执行'
|
||
|
|
when bc.state='3' then '未执行'
|
||
|
|
when bc.state='4' then '已执行'
|
||
|
|
when bc.state='5' then '已取消'
|
||
|
|
end as statename
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
where bc.del_flag='0'
|
||
|
|
<if test="idNumber != null and idNumber != ''">
|
||
|
|
and bc.id_number like concat('%', #{idNumber}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
and bc.name like concat('%', #{name}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="certificateNo != null and certificateNo != ''">
|
||
|
|
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||
|
|
</if>
|
||
|
|
<if test='isAdmin != null and isAdmin == "1"'>
|
||
|
|
and bc.dept_id in (
|
||
|
|
select dept_id from sys_dept where dept_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId}))
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})))
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
order by bc.create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCertificateLifespanList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select * from (
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday,bc.issue_lifespan as issuelifespan
|
||
|
|
,bc.is_ele as isele,sd.dept_name as deptname,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||
|
|
,bc.state,case
|
||
|
|
when bc.state='0' then '未上交'
|
||
|
|
when bc.state='1' then '未执行'
|
||
|
|
when bc.state='2' then '已执行'
|
||
|
|
when bc.state='3' then '未执行'
|
||
|
|
when bc.state='4' then '已执行'
|
||
|
|
when bc.state='5' then '已取消'
|
||
|
|
end as statename,
|
||
|
|
bct.process_state as processstate,
|
||
|
|
bct.verification_code as verificationcode,
|
||
|
|
case when bct.process_state='0' then '未处理' else '已处理' end processstatename,
|
||
|
|
bct.task_type as tasktype,
|
||
|
|
case when bct.task_type='1' then '存证' else '取证' end tasktypename,
|
||
|
|
bct.process_date as processdate,bct.real_process_date as realprocessdate,
|
||
|
|
bct.email,
|
||
|
|
DATEDIFF(DATE_FORMAT(case when bct.real_process_date is null then SYSDATE() else bct.real_process_date end,'%Y-%m-%d'), DATE_FORMAT(bct.process_date,'%Y-%m-%d')) AS processGapDate,
|
||
|
|
bct.create_time as createTime
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
left join basic_certificate_task bct on bc.certificate_No=bct.certificate_No
|
||
|
|
where bct.task_type='1' and bc.del_flag='0' and bct.process_state='0'
|
||
|
|
<if test="idNumber != null and idNumber != ''">
|
||
|
|
and bc.id_number like concat('%', #{idNumber}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
and bc.name like concat('%', #{name}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="certificateNo != null and certificateNo != ''">
|
||
|
|
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||
|
|
</if>
|
||
|
|
<if test='isAdmin != null and isAdmin == "1"'>
|
||
|
|
and bc.dept_id in (
|
||
|
|
select dept_id from sys_dept where dept_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId}))
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})))
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
order by bc.create_time desc
|
||
|
|
) a where processGapDate>0
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCertificateOverdueList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select * from (
|
||
|
|
select bc.dept_id as deptid,bc.name,bc.birthday,bc.birth_addr as birthaddr
|
||
|
|
,bc.certificate_type as certificatetype,bc.id_number as idnumber,sdd.dict_label as certificatetypename
|
||
|
|
,bc.certificate_no as certificateno,bc.issue_addr as issueaddr,bc.issue_day as issueday,bc.issue_lifespan as issuelifespan
|
||
|
|
,bc.is_ele as isele,sd.dept_name as deptname,sd.dept_full_name as deptfullName ,case when bc.is_ele='0' then '否' else '是' end as iselename
|
||
|
|
,bc.state,case
|
||
|
|
when bc.state='0' then '未上交'
|
||
|
|
when bc.state='1' then '存入中'
|
||
|
|
when bc.state='2' then '已存入'
|
||
|
|
when bc.state='3' then '取出中'
|
||
|
|
when bc.state='4' then '已取出'
|
||
|
|
end as statename,
|
||
|
|
DATEDIFF(DATE_FORMAT(SYSDATE(),'%Y-%m-%d'), DATE_FORMAT(bc.issue_lifespan,'%Y-%m-%d')) AS processGapDate
|
||
|
|
from basic_certificate bc
|
||
|
|
left join sys_dept sd on bc.dept_id=sd.dept_id
|
||
|
|
left join (select * from sys_dict_data where dict_type='sys_certificate_type') sdd on bc.certificate_type=sdd.dict_value
|
||
|
|
where bc.del_flag='0'
|
||
|
|
<if test="idNumber != null and idNumber != ''">
|
||
|
|
and bc.id_number like concat('%', #{idNumber}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
and bc.name like concat('%', #{name}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="certificateNo != null and certificateNo != ''">
|
||
|
|
and bc.certificate_no like concat('%', #{certificateNo}, '%')
|
||
|
|
</if>
|
||
|
|
<if test='isAdmin != null and isAdmin == "1"'>
|
||
|
|
and bc.dept_id in (
|
||
|
|
select dept_id from sys_dept where dept_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id=#{deptId}
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId}))
|
||
|
|
union
|
||
|
|
select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id in (select dept_id from sys_dept where parent_id=#{deptId})))
|
||
|
|
)
|
||
|
|
</if>
|
||
|
|
order by bc.create_time desc
|
||
|
|
) a where processGapDate>0
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCertificateTypeList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select dict_value as certificateType,dict_label as certificateTypeName from sys_dict_data
|
||
|
|
where dict_type='sys_certificate_type' and dict_label is not null
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectCertificateOrgList" parameterType="com.bonus.canteen.core.certificate.vo.CertificateInfo" resultType="com.bonus.canteen.core.certificate.vo.CertificateInfo">
|
||
|
|
select distinct dept_id as deptid,dept_name as deptname,dept_full_name as deptFullName from sys_dept where dept_name is not null
|
||
|
|
</select>
|
||
|
|
</mapper>
|