稽核区域配置

This commit is contained in:
zhangchenbiao
2023-07-19 16:04:17 +08:00
parent 4517f2e770
commit fc0aedae7a
28 changed files with 1185 additions and 29 deletions

View File

@@ -0,0 +1,138 @@
<?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.cool.store.mapper.HyInspectionSettingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyInspectionSettingDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="zone_name" jdbcType="VARCHAR" property="zoneName"/>
<result column="inspection_user_id" jdbcType="VARCHAR" property="inspectionUserId"/>
<result column="create_user_id" jdbcType="VARCHAR" property="createUserId"/>
<result column="update_user_id" jdbcType="VARCHAR" property="updateUserId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
id, zone_name, inspection_user_id, create_user_id, update_user_id, create_time, update_time, deleted
</sql>
<insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
insert into hy_inspection_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="zoneName != null">
zone_name,
</if>
<if test="inspectionUserId != null">
inspection_user_id,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="zoneName != null">
#{zoneName},
</if>
<if test="inspectionUserId != null">
#{inspectionUserId},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="deleted != null">
#{deleted},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_inspection_setting
<set>
<if test="zoneName != null">
zone_name = #{zoneName},
</if>
<if test="inspectionUserId != null">
inspection_user_id = #{inspectionUserId},
</if>
<if test="createUserId != null">
create_user_id = #{createUserId},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
</set>
where id = #{id}
</update>
<select id="getInspectionSettingPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0'
order by create_time desc
</select>
<select id="getInspectionSettingDetail" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and id = #{inspectionSettingId}
</select>
<select id="getInspectionUserIds" resultType="string">
select inspection_user_id from hy_inspection_setting where deleted = '0'
</select>
<select id="getHyInspectionSettingByIds" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and id in <foreach collection="inspectionSettingIds" item="inspectionSettingId" open="(" close=")" separator=",">#{inspectionSettingId}</foreach>
</select>
<select id="getHyInspectionSettingByUserId" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting
where
deleted = '0' and inspection_user_id = #{excludeInspectionSettingId}
<if test="excludeInspectionSettingId != null">
and id != #{excludeInspectionSettingId}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,109 @@
<?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.cool.store.mapper.HyInspectionSettingMappingMapper">
<resultMap id="BaseResultMap" type="com.cool.store.entity.HyInspectionSettingMappingDO">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="inspection_setting_id" jdbcType="BIGINT" property="inspectionSettingId"/>
<result column="open_area_mapping_id" jdbcType="BIGINT" property="openAreaMappingId"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Base_Column_List">
id, inspection_setting_id, open_area_mapping_id, create_time, update_time, deleted
</sql>
<insert id="batchInsertSelective">
<foreach collection="insertList" item="record" separator=";">
insert into hy_inspection_setting_mapping
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="record.inspectionSettingId != null">
inspection_setting_id,
</if>
<if test="record.openAreaMappingId != null">
open_area_mapping_id,
</if>
<if test="record.createTime != null">
create_time,
</if>
<if test="record.updateTime != null">
update_time,
</if>
<if test="record.deleted != null">
deleted,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="record.inspectionSettingId != null">
#{record.inspectionSettingId},
</if>
<if test="record.openAreaMappingId != null">
#{record.openAreaMappingId},
</if>
<if test="record.createTime != null">
#{record.createTime},
</if>
<if test="record.updateTime != null">
#{record.updateTime},
</if>
<if test="record.deleted != null">
#{record.deleted},
</if>
</trim>
ON DUPLICATE KEY UPDATE update_time = now(), deleted = values(deleted)
</foreach>
</insert>
<update id="updateByPrimaryKeySelective">
update hy_inspection_setting_mapping
<set>
<if test="inspectionSettingId != null">
inspection_setting_id = #{inspectionSettingId},
</if>
<if test="openAreaMappingId != null">
open_area_mapping_id = #{openAreaMappingId},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
<if test="deleted != null">
deleted = #{deleted},
</if>
</set>
where id = #{id}
</update>
<select id="getOpenAreaMappingIds" resultType="long">
select open_area_mapping_id from hy_inspection_setting_mapping where inspection_setting_id = #{inspectionSettingId} and deleted = '0'
</select>
<update id="deleteNotInOpenAreaMappingIds">
update
hy_inspection_setting_mapping
set
deleted = '1' , update_time = new()
where
inspection_setting_id = #{inspectionSettingId} and open_area_mapping_id not in
<foreach collection="openAreaMappingIds" separator="," open="(" close=")" item="openAreaMappingId" >#{openAreaMappingId}</foreach>
</update>
<update id="deleteInspectionSettingMapping">
update hy_inspection_setting_mapping set deleted = '1' , update_time = new() where inspection_setting_id = #{inspectionSettingId}
</update>
<select id="getConflictInspectionSetting" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
hy_inspection_setting_mapping
where
deleted = '0'
and
open_area_mapping_id in
<foreach collection="openAreaMappingIds" separator="," open="(" close=")" item="openAreaMappingId" >#{openAreaMappingId}</foreach>
<if test="inspectionSettingId != null">
and inspection_setting_id != #{inspectionSettingId}
</if>
</select>
</mapper>

View File

@@ -208,4 +208,13 @@
<select id="getSubRegionIds" resultType="string">
select region_id from region where deleted = 0 and <foreach collection="regionPathList" item="regionPath" open="(" close=")" separator="or"> region_path like concat(#{regionPath}, '%')</foreach>
</select>
<select id="getSubRegion" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
region
where
deleted = 0 and parent_id = #{regionId}
</select>
</mapper>

View File

@@ -131,15 +131,15 @@
</update>
<select id="getUserListByRegionId" resultType="string">
select user_id from user_region_mapping where region_id = #{regionId}
select user_id from user_region_mapping where region_id = #{regionId} and deleted = '0'
</select>
<select id="getRegionIdsByUserId" resultType="string">
select region_id from user_region_mapping where user_id = #{userId}
select region_id from user_region_mapping where user_id = #{userId} and deleted = '0'
</select>
<select id="getUserListByRegionIds" resultType="string">
select user_id from user_region_mapping where region_id in <foreach collection="regionIds" item="regionId" open="(" close=")" separator=",">#{regionId}</foreach>
select user_id from user_region_mapping where deleted = '0' and region_id in <foreach collection="regionIds" item="regionId" open="(" close=")" separator=",">#{regionId}</foreach>
</select>
</mapper>