稽核区域配置
This commit is contained in:
@@ -11,6 +11,8 @@ import org.springframework.stereotype.Repository;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -109,7 +111,22 @@ public class EnterpriseUserDAO {
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName() + " " + v.getMobile()));
|
||||
}
|
||||
|
||||
public Map<String, String> getUserNameMap(List<String> userIds){
|
||||
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), v -> v.getName()));
|
||||
}
|
||||
|
||||
public Map<String, EnterpriseUserDO> getUserMap(List<String> userIds){
|
||||
List<EnterpriseUserDO> userList = getUserInfoByUserIds(userIds);
|
||||
return userList.stream().filter(o->!StringUtils.isAnyBlank(o.getMobile(), o.getName())).collect(Collectors.toMap(k -> k.getUserId(), Function.identity()));
|
||||
}
|
||||
|
||||
public String selectByMobile(String mobile) {
|
||||
return enterpriseUserMapper.selectByMobile(mobile);
|
||||
}
|
||||
|
||||
public String getUserName(String userId){
|
||||
EnterpriseUserDO userInfo = getUserInfoById(userId);
|
||||
return Optional.ofNullable(userInfo).map(EnterpriseUserDO::getName).orElse(StringUtils.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.HyInspectionSettingDO;
|
||||
import com.cool.store.mapper.HyInspectionSettingMapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: HyInspectionSettingDAO
|
||||
* @Description:
|
||||
* @date 2023-07-18 16:29
|
||||
*/
|
||||
@Repository
|
||||
public class HyInspectionSettingDAO {
|
||||
|
||||
@Resource
|
||||
private HyInspectionSettingMapper hyInspectionSettingMapper;
|
||||
|
||||
/**
|
||||
* 获取分页
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
public Page<HyInspectionSettingDO> getInspectionSettingPage(Integer pageNum, Integer pageSize){
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
Page<HyInspectionSettingDO> resultPage = hyInspectionSettingMapper.getInspectionSettingPage();
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取稽查详情
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
public HyInspectionSettingDO getInspectionSettingDetail(Long inspectionSettingId){
|
||||
if(Objects.isNull(inspectionSettingId)){
|
||||
return null;
|
||||
}
|
||||
return hyInspectionSettingMapper.getInspectionSettingDetail(inspectionSettingId);
|
||||
}
|
||||
|
||||
public Long addInspectionSetting(HyInspectionSettingDO param){
|
||||
hyInspectionSettingMapper.insertSelective(param);
|
||||
return param.getId();
|
||||
}
|
||||
|
||||
public Integer updateInspectionSetting(HyInspectionSettingDO param){
|
||||
return hyInspectionSettingMapper.updateByPrimaryKeySelective(param);
|
||||
}
|
||||
|
||||
public List<String> getInspectionUserIds(){
|
||||
return hyInspectionSettingMapper.getInspectionUserIds();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取配置列表
|
||||
* @param inspectionSettingIds
|
||||
* @return
|
||||
*/
|
||||
public List<HyInspectionSettingDO> getHyInspectionSettingByIds(List<Long> inspectionSettingIds){
|
||||
if(CollectionUtils.isEmpty(inspectionSettingIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyInspectionSettingMapper.getHyInspectionSettingByIds(inspectionSettingIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户配置的区域 编辑的时候排除某个配置
|
||||
* @param inspectionUserId
|
||||
* @param excludeInspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
public List<HyInspectionSettingDO> getHyInspectionSettingByUserId(String inspectionUserId, Long excludeInspectionSettingId){
|
||||
if(StringUtils.isBlank(inspectionUserId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyInspectionSettingMapper.getHyInspectionSettingByUserId(inspectionUserId, excludeInspectionSettingId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.entity.HyInspectionSettingMappingDO;
|
||||
import com.cool.store.mapper.HyInspectionSettingMappingMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: HyInspectionSettingMappingDAO
|
||||
* @Description:
|
||||
* @date 2023-07-18 16:29
|
||||
*/
|
||||
@Repository
|
||||
public class HyInspectionSettingMappingDAO {
|
||||
|
||||
@Resource
|
||||
private HyInspectionSettingMappingMapper hyInspectionSettingMappingMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 获取区域ids
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
public List<Long> getOpenAreaMappingIds(Long inspectionSettingId){
|
||||
if(Objects.isNull(inspectionSettingId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyInspectionSettingMappingMapper.getOpenAreaMappingIds(inspectionSettingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增映射关系
|
||||
* @param inspectionSettingId
|
||||
* @param openAreaMappingIds
|
||||
* @return
|
||||
*/
|
||||
public Integer addInspectionSettingMapping(Long inspectionSettingId, List<Long> openAreaMappingIds){
|
||||
if(CollectionUtils.isEmpty(openAreaMappingIds) || Objects.isNull(inspectionSettingId)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
List<HyInspectionSettingMappingDO> insertList = new ArrayList<>();
|
||||
for (Long openAreaMappingId : openAreaMappingIds) {
|
||||
HyInspectionSettingMappingDO insert = new HyInspectionSettingMappingDO();
|
||||
insert.setInspectionSettingId(inspectionSettingId);
|
||||
insert.setOpenAreaMappingId(openAreaMappingId);
|
||||
insert.setCreateTime(new Date());
|
||||
insert.setDeleted(Boolean.FALSE);
|
||||
insertList.add(insert);
|
||||
}
|
||||
return hyInspectionSettingMappingMapper.batchInsertSelective(insertList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新映射关系
|
||||
* @param inspectionSettingId
|
||||
* @param openAreaMappingIds
|
||||
* @return
|
||||
*/
|
||||
public Integer updateInspectionSettingMapping(Long inspectionSettingId, List<Long> openAreaMappingIds){
|
||||
hyInspectionSettingMappingMapper.deleteNotInOpenAreaMappingIds(inspectionSettingId, openAreaMappingIds);
|
||||
return addInspectionSettingMapping(inspectionSettingId, openAreaMappingIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除映射关系
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
public Integer deleteInspectionSettingMapping(Long inspectionSettingId){
|
||||
if(Objects.isNull(inspectionSettingId)){
|
||||
return CommonConstants.ZERO;
|
||||
}
|
||||
return hyInspectionSettingMappingMapper.deleteInspectionSettingMapping(inspectionSettingId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取冲突的映射关系
|
||||
* @param inspectionSettingId
|
||||
* @param openAreaMappingIds
|
||||
* @return
|
||||
*/
|
||||
public List<HyInspectionSettingMappingDO> getConflictInspectionSetting(Long inspectionSettingId, List<Long> openAreaMappingIds){
|
||||
if(CollectionUtils.isEmpty(openAreaMappingIds)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return hyInspectionSettingMappingMapper.getConflictInspectionSetting(inspectionSettingId, openAreaMappingIds);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -89,6 +89,14 @@ public class HyOpenAreaInfoDAO {
|
||||
return hyOpenAreaInfoMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
public Map<Long, String> getNameMapByIds(List<Long> ids){
|
||||
if (CollectionUtils.isEmpty(ids)){
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
List<HyOpenAreaInfoDO> hyOpenAreaInfoDOS = hyOpenAreaInfoMapper.selectByIds(ids);
|
||||
return ListUtils.emptyIfNull(hyOpenAreaInfoDOS).stream().collect(Collectors.toMap(k->k.getId(), v->v.getAreaName(), (k1, k2)->k1));
|
||||
}
|
||||
|
||||
public Map<String, String> selectNameMapByIds(List<Long> ids){
|
||||
if (CollectionUtils.isEmpty(ids)){
|
||||
return Maps.newHashMap();
|
||||
|
||||
@@ -108,4 +108,16 @@ public class RegionDAO {
|
||||
List<String> regionPathList = regionList.stream().map(RegionDO::getRegionPath).collect(Collectors.toList());
|
||||
return regionMapper.getSubRegionIds(regionPathList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子部门
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
public List<RegionDO> getSubRegion(String regionId){
|
||||
if(StringUtils.isBlank(regionId)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return regionMapper.getSubRegion(regionId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.HyInspectionSettingDO;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-07-18 04:27
|
||||
*/
|
||||
public interface HyInspectionSettingMapper {
|
||||
/**
|
||||
*
|
||||
* 默认插入方法,只会给有值的字段赋值
|
||||
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||
* dateTime:2023-07-18 04:27
|
||||
*/
|
||||
int insertSelective(HyInspectionSettingDO record);
|
||||
|
||||
/**
|
||||
*
|
||||
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||
* dateTime:2023-07-18 04:27
|
||||
*/
|
||||
int updateByPrimaryKeySelective(HyInspectionSettingDO record);
|
||||
|
||||
/**
|
||||
* 获取稽核区域设置分页
|
||||
* @return
|
||||
*/
|
||||
Page<HyInspectionSettingDO> getInspectionSettingPage();
|
||||
|
||||
/**
|
||||
* 获取稽核详情
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
HyInspectionSettingDO getInspectionSettingDetail(@Param("inspectionSettingId") Long inspectionSettingId);
|
||||
|
||||
/**
|
||||
* 获取已经配置的稽核人
|
||||
* @return
|
||||
*/
|
||||
List<String> getInspectionUserIds();
|
||||
|
||||
/**
|
||||
* 根据id批量获取
|
||||
* @param inspectionSettingIds
|
||||
* @return
|
||||
*/
|
||||
List<HyInspectionSettingDO> getHyInspectionSettingByIds(@Param("inspectionSettingIds") List<Long> inspectionSettingIds);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param inspectionUserId
|
||||
* @return
|
||||
*/
|
||||
List<HyInspectionSettingDO> getHyInspectionSettingByUserId(String inspectionUserId, Long excludeInspectionSettingId);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.HyInspectionSettingMappingDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @date 2023-07-18 04:28
|
||||
*/
|
||||
public interface HyInspectionSettingMappingMapper {
|
||||
/**
|
||||
*
|
||||
* 默认插入方法,只会给有值的字段赋值
|
||||
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||
* dateTime:2023-07-18 04:28
|
||||
*/
|
||||
int batchInsertSelective(@Param("insertList") List<HyInspectionSettingMappingDO> insertList);
|
||||
|
||||
/**
|
||||
*
|
||||
* 默认更新方法,根据主键更新,不会把null值更新到数据库,避免覆盖之前有值的
|
||||
* dateTime:2023-07-18 04:28
|
||||
*/
|
||||
int updateByPrimaryKeySelective(HyInspectionSettingMappingDO record);
|
||||
|
||||
/**
|
||||
* 获取区域ids
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
List<Long> getOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId);
|
||||
|
||||
/**
|
||||
* 删除不在的城市
|
||||
* @param inspectionSettingId
|
||||
* @param openAreaMappingIds
|
||||
* @return
|
||||
*/
|
||||
Integer deleteNotInOpenAreaMappingIds(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param inspectionSettingId
|
||||
* @return
|
||||
*/
|
||||
Integer deleteInspectionSettingMapping(@Param("inspectionSettingId") Long inspectionSettingId);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param inspectionSettingId
|
||||
* @param openAreaMappingIds
|
||||
* @return
|
||||
*/
|
||||
List<HyInspectionSettingMappingDO> getConflictInspectionSetting(@Param("inspectionSettingId") Long inspectionSettingId, @Param("openAreaMappingIds") List<Long> openAreaMappingIds);
|
||||
}
|
||||
@@ -78,4 +78,11 @@ public interface RegionMapper {
|
||||
* @return
|
||||
*/
|
||||
List<String> getSubRegionIds(@Param("regionPathList") List<String> regionPathList);
|
||||
|
||||
/**
|
||||
* 获取子部门
|
||||
* @param regionId
|
||||
* @return
|
||||
*/
|
||||
List<RegionDO> getSubRegion(@Param("regionId") String regionId);
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -3,4 +3,4 @@ jdbc.url = jdbc:mysql://dingpushcoolcollege.mysql.rds.aliyuncs.com:3306/coolcoll
|
||||
jdbc.user= coolstore
|
||||
jdbc.password = CSCErYcXniNYm7bT
|
||||
|
||||
table.name = sys_menu
|
||||
table.name = hy_inspection_setting_mapping
|
||||
Reference in New Issue
Block a user