Commit 1b455519 by hzc

修改基础指标删除的限制条件,去掉基础指标目录机构编码条件

parent 0248de02
...@@ -60,25 +60,38 @@ public class IndCatalogCtrl { ...@@ -60,25 +60,38 @@ public class IndCatalogCtrl {
indCatalogService.recursionDelete(ids); indCatalogService.recursionDelete(ids);
LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,"删除基础项目录:{}",message.toString()); LogManager.logInfo(Constants.LOG_INDICATOR_BASE_INDI_API,"删除基础项目录:{}",message.toString());
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
@ApiOperation(value = "获取基础指标目录", notes = "获取基础指标目录") @ApiOperation(value = "获取基础指标目录", notes = "获取基础指标目录")
@PostMapping(value = "/getBaseIndCatalog") @PostMapping(value = "/getBaseIndCatalog")
public List<IndCatalog> getBaseIndCatalog(@RequestParam(required=false) Integer parentId, public List<IndCatalog> getBaseIndCatalog(@RequestParam(required=false) Integer parentId,
@RequestParam List<String> codes){ @RequestParam(required = false) List<String> codes){
return indCatalogService.getCatalog(parentId, codes); return indCatalogService.getCatalog(parentId, codes);
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
@ApiOperation(value = "根据关键字搜索获取基础指标目录", notes = "根据关键字搜索获取基础指标目录") @ApiOperation(value = "根据关键字搜索获取基础指标目录", notes = "根据关键字搜索获取基础指标目录")
@PostMapping(value = "/getBaseIndCatalogByKeyword") @PostMapping(value = "/getBaseIndCatalogByKeyword")
public List<IndCatalog> getBaseIndCatalogByKeyword(@RequestParam(required=false) String keyword, public List<IndCatalog> getBaseIndCatalogByKeyword(@RequestParam(required=false) String keyword,
@RequestParam List<String> codes){ @RequestParam(required = false) List<String> codes){
return indCatalogService.getCatalogByKeyword(keyword,codes); return indCatalogService.getCatalogByKeyword(keyword,codes);
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
@ApiOperation(value = "获取第一个有效的基础目录节点", notes = "获取第一个有效的基础目录节点") @ApiOperation(value = "获取第一个有效的基础目录节点", notes = "获取第一个有效的基础目录节点")
@PostMapping(value = "/getFirstVaildBaseIndCatalog") @PostMapping(value = "/getFirstVaildBaseIndCatalog")
public IndCatalog getFirstVaildBaseIndCatalog(@RequestParam Integer pid, public IndCatalog getFirstVaildBaseIndCatalog(@RequestParam Integer pid,
@RequestParam List<String> codes){ @RequestParam(required = false) List<String> codes){
return indCatalogService.getFirstVaildCatalog(pid, codes); return indCatalogService.getFirstVaildCatalog(pid, codes);
} }
......
...@@ -13,13 +13,25 @@ import tk.mybatis.mapper.common.BaseMapper; ...@@ -13,13 +13,25 @@ import tk.mybatis.mapper.common.BaseMapper;
public interface IndCatalogMapper extends BaseMapper<IndCatalog>{ public interface IndCatalogMapper extends BaseMapper<IndCatalog>{
public void deleteByIdIn(@Param("ids")List<Integer> ids); public void deleteByIdIn(@Param("ids")List<Integer> ids);
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
public List<IndCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(Map<String,Object> params); public List<IndCatalog> findByParentIdAndCodeInOrderByLastUpdateTimeDesc(Map<String,Object> params);
public List<IndCatalog> findByParentId(@Param("pid") Integer pid); public List<IndCatalog> findByParentId(@Param("pid") Integer pid);
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
public List<IndCatalog> findByKeyword(Map<String,Object> params); public List<IndCatalog> findByKeyword(Map<String,Object> params);
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
public List<IndCatalog> findFirstVaildCatalog(Map<String,Object> params); public List<IndCatalog> findFirstVaildCatalog(Map<String,Object> params);
public List<IndCatalog> findByCatalogIdIn(@Param("ids") List<Integer> ids); public List<IndCatalog> findByCatalogIdIn(@Param("ids") List<Integer> ids);
......
...@@ -14,4 +14,11 @@ public interface IndicatorsRelMapper extends BaseMapper<IndicatorsRel>{ ...@@ -14,4 +14,11 @@ public interface IndicatorsRelMapper extends BaseMapper<IndicatorsRel>{
public List<IndicatorsRel> findByIndId(@Param("indId")String indId); public List<IndicatorsRel> findByIndId(@Param("indId")String indId);
public void deleteByIndId(@Param("indId")String indId); public void deleteByIndId(@Param("indId")String indId);
/**
* 通过关联指标id查询
* @Param [relIndId]
* @Date 2020/12/28 9:31
* @Author hzc
**/
List<IndicatorsRel> selectByRelIndId(@Param("relIndId") String relIndId);
} }
...@@ -6,6 +6,8 @@ import java.util.HashMap; ...@@ -6,6 +6,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.keymobile.indicators.model.entity.indicators.IndicatorsRel;
import com.keymobile.indicators.model.mapper.indmapper.IndicatorsRelMapper;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -24,7 +26,6 @@ public class BaseIndDefService { ...@@ -24,7 +26,6 @@ public class BaseIndDefService {
private IndicatorsRelService indRelService; private IndicatorsRelService indRelService;
@Autowired @Autowired
private DriveIndDefService driveIndDefService; private DriveIndDefService driveIndDefService;
public String saveOrUpdate(BaseIndDef baseIndDef,Integer catalogId, public String saveOrUpdate(BaseIndDef baseIndDef,Integer catalogId,
String catalogIdPath,String user,String isUpdate,String code) String catalogIdPath,String user,String isUpdate,String code)
throws Exception{ throws Exception{
...@@ -88,8 +89,7 @@ public class BaseIndDefService { ...@@ -88,8 +89,7 @@ public class BaseIndDefService {
StringBuilder message = new StringBuilder(""); StringBuilder message = new StringBuilder("");
List<String> canDeleteList = new ArrayList<>(); List<String> canDeleteList = new ArrayList<>();
for(String indId : indIds) { for(String indId : indIds) {
if(driveIndDefService.getByIndFormatLike(indId).isEmpty()&& if(indRelService.selectByRelIndId(indId).isEmpty()) {//基础项都没有关联指标才能删除
this.getByIndFormatLike(indId).isEmpty()) {//基础项都没有关联指标才能删除
canDeleteList.add(indId); canDeleteList.add(indId);
}else { }else {
BaseIndDef baseIndDef = this.getById(indId); BaseIndDef baseIndDef = this.getById(indId);
......
...@@ -86,7 +86,11 @@ public class IndCatalogService { ...@@ -86,7 +86,11 @@ public class IndCatalogService {
baseIndDefMapper.deleteByCatalogIdIn(result); baseIndDefMapper.deleteByCatalogIdIn(result);
} }
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
//获取目录树 //获取目录树
public List<IndCatalog> getCatalog(Integer parentId,List<String> codes){ public List<IndCatalog> getCatalog(Integer parentId,List<String> codes){
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
...@@ -94,7 +98,11 @@ public class IndCatalogService { ...@@ -94,7 +98,11 @@ public class IndCatalogService {
paramMap.put("codes", codes); paramMap.put("codes", codes);
return indCatalogMapper.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(paramMap); return indCatalogMapper.findByParentIdAndCodeInOrderByLastUpdateTimeDesc(paramMap);
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
//根据目录树获取 //根据目录树获取
public List<IndCatalog> getCatalogByKeyword(String keyword,List<String> codes){ public List<IndCatalog> getCatalogByKeyword(String keyword,List<String> codes){
if(StringUtils.isBlank(keyword)) { if(StringUtils.isBlank(keyword)) {
...@@ -105,7 +113,11 @@ public class IndCatalogService { ...@@ -105,7 +113,11 @@ public class IndCatalogService {
params.put("codes", codes); params.put("codes", codes);
return indCatalogMapper.findByKeyword(params); return indCatalogMapper.findByKeyword(params);
} }
/**
* mapper注释codes条件
* @Date 2020/12/28 11:04
* @Author hzc
**/
//获取第一个有效目录节点 //获取第一个有效目录节点
public IndCatalog getFirstVaildCatalog(Integer pid,List<String> codes) { public IndCatalog getFirstVaildCatalog(Integer pid,List<String> codes) {
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
......
...@@ -189,4 +189,14 @@ public class IndicatorsRelService { ...@@ -189,4 +189,14 @@ public class IndicatorsRelService {
} }
} }
} }
/**
* 通过关联指标id查询
* @Param [relIndId]
* @Date 2020/12/28 9:31
* @Author hzc
**/
public List<IndicatorsRel> selectByRelIndId(String relIndId) {
return indicatorsRelMapper.selectByRelIndId(relIndId);
}
} }
...@@ -141,7 +141,7 @@ public class IndicatorsReportService { ...@@ -141,7 +141,7 @@ public class IndicatorsReportService {
paramMap.put("compareObjs", compareObjs); paramMap.put("compareObjs", compareObjs);
log.info("开始清除报表三数据:date={},type={},code={},compareObjs={}",date,type,code,compareObjs); log.info("开始清除报表三数据:date={},type={},code={},compareObjs={}",date,type,code,compareObjs);
reportThreeMapper.deleteByParam(paramMap); reportThreeMapper.deleteByParam(paramMap);
log.info("开始清除报表四数据:compareCatalog={}",compareCatalog); log.info("开始清除报表四数据:compareCatalog={},date={}",compareCatalog,date);
indicatorsReportFourMapper.deleteByCompareCatalog(compareCatalog,date); indicatorsReportFourMapper.deleteByCompareCatalog(compareCatalog,date);
}else{ }else{
...@@ -252,7 +252,7 @@ public class IndicatorsReportService { ...@@ -252,7 +252,7 @@ public class IndicatorsReportService {
indReportData.setEffectiveIndCount( indReportData.setEffectiveIndCount(
indReportData.getEffectiveIndCount()+1); indReportData.getEffectiveIndCount()+1);
} }
//保存同期值 //保存同期值 报表四
indicatorsReportFour.setSameValue(sameCalResult.getValue()); indicatorsReportFour.setSameValue(sameCalResult.getValue());
//算增幅 //算增幅
if(!"NaN".equals(sameCalResult.getValue()) if(!"NaN".equals(sameCalResult.getValue())
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.keymobile.indicators.model.mapper.indmapper.IndCatalogMapper"> <mapper namespace="com.keymobile.indicators.model.mapper.indmapper.IndCatalogMapper">
<delete id="deleteByIdIn" parameterType="java.util.List"> <delete id="deletefindByParentIdAndCodeInOrderByLastUpdateTimeDescByIdIn" parameterType="java.util.List">
delete delete
from base_ind_catalog from base_ind_catalog
where id in where id in
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
<select id="findByParentIdAndCodeInOrderByLastUpdateTimeDesc" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" > <select id="findByParentIdAndCodeInOrderByLastUpdateTimeDesc" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" >
select * select *
from base_ind_catalog from base_ind_catalog
where parent_id = #{pid} and where parent_id = #{pid}
code in <!-- and code in-->
<foreach item="id" collection="codes" open="(" close=")" separator=","> <!-- <foreach item="id" collection="codes" open="(" close=")" separator=",">-->
#{id} <!-- #{id}-->
</foreach> <!-- </foreach>-->
order by last_update_time desc order by last_update_time desc
</select> </select>
...@@ -30,22 +30,22 @@ ...@@ -30,22 +30,22 @@
<select id="findByKeyword" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" > <select id="findByKeyword" parameterType="map" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" >
select * select *
from base_ind_catalog from base_ind_catalog
where catalog_name like #{keyword} and where catalog_name like #{keyword}
code in <!-- and code in-->
<foreach item="id" collection="codes" open="(" close=")" separator=","> <!-- <foreach item="id" collection="codes" open="(" close=")" separator=",">-->
#{id} <!-- #{id}-->
</foreach> <!-- </foreach>-->
</select> </select>
<select id="findFirstVaildCatalog" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" > <select id="findFirstVaildCatalog" resultType="com.keymobile.indicators.model.entity.indicators.IndCatalog" >
select * select *
from base_ind_catalog from base_ind_catalog
where id_path like #{pidPath} and where id_path like #{pidPath} and
catalog_type = '1' and catalog_type = '1'
code in <!-- and code in-->
<foreach item="id" collection="codes" open="(" close=")" separator=","> <!-- <foreach item="id" collection="codes" open="(" close=")" separator=",">-->
#{id} <!-- #{id}-->
</foreach> <!-- </foreach>-->
order by last_update_time desc order by last_update_time desc
</select> </select>
......
...@@ -12,4 +12,9 @@ ...@@ -12,4 +12,9 @@
from ind_relation from ind_relation
where ind_id = #{indId} where ind_id = #{indId}
</delete> </delete>
<select id="selectByRelIndId" resultType="com.keymobile.indicators.model.entity.indicators.IndicatorsRel">
select *
from ind_relation
where rel_ind_id = #{relIndId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment