gz_safety_ma/src/main/resources/mappers/business/system/SysAuditMapper.xml

77 lines
3.2 KiB
XML
Raw Normal View History

2025-01-16 19:19:59 +08:00
<?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.aqgqj.business.system.mapper.SysAuditMapper">
<!--数据新增-->
<insert id="addAuditConfig" useGeneratedKeys="true" keyProperty="id" >
insert into sys_audit_config(
type,audit_type,aduit_user_id,type_name,sort,model_id,model_code
)values (#{type},#{auditType},#{auditUserId},#{typeName},#{sort},#{modelId},#{modelCode})
</insert>
<!--查询-->
<insert id="addAuditUser">
insert into sys_audit_user_config(config_id,user_id,user_dept)values
<foreach collection="list" item="item" separator=",">
(#{param.id},#{item.userId},#{item.deptId})
</foreach>
</insert>
<update id="updateConfig">
update sys_audit_config set
type=#{type},audit_type=#{auditType},aduit_user_id=#{auditUserId},type_name=#{typeName},
sort=#{sort},model_id=#{modelId},model_code=#{modelCode}
WHERE id=#{id}
</update>
<delete id="deleteAuditUserId">
delete from sys_audit_user_config where config_id=#{id}
</delete>
<!--系统审核模块-->
<select id="getAuditModel" resultType="com.bonus.aqgqj.business.system.entity.AuditModel">
select id, code, name, creater AS creator,
create_time createTime, updater, updater_time updateTime,
remark , model_code modelCode
FROM sys_audit_model
<where>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(code,#{keyWord}) > 0
)
</if>
</where>
</select>
<!--查询用户下拉选-->
<select id="getUserSelected" resultType="com.bonus.aqgqj.business.system.entity.UserSelected">
select id userId,name,login_name userName,ORG_ID deptId ,
COMPANY_ID conpanyId
from pm_user
WHERE IS_ACTIVE=1
</select>
<select id="getAuditNum" resultType="java.lang.Integer">
select count(1)
from sys_audit_config
<where>
<if test="id!=null and id!=''">
and id!=#{id}
</if>
<if test="type!=null and type!=''">
and type=#{type}
</if>
<if test="modelId!=null and modelId!=''">
and model_id=#{modelId}
</if>
<if test="modelCode!=null and modelCode!=''">
and model_code=#{modelCode}
</if>
</where>
</select>
<select id="getAuditList" resultType="com.bonus.aqgqj.business.system.entity.AuditUser">
select auc.user_id userId,pu.NAME userName ,pu.LOGIN_NAME loginName ,com.name comName
,sac.audit_type auditType,sac.id AS configId
from sys_audit_config sac
left join sys_audit_user_config auc on auc.config_id=sac.id
left join pm_user pu on pu.id =auc.user_id
left join bm_company com on com.id=pu.COMPANY_ID
where sac.model_id=#{id}
and sac.type=#{type}
</select>
</mapper>