Commit 1b455519 by hzc

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

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