Browse Source

统计单元基本配置改造测试版

develop
ljlong_2630 11 months ago
parent
commit
6919543b5d
  1. 13
      lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java
  2. 27
      lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java
  3. 27
      lzbi-module/src/main/java/com/lzbi/targetFolder/domain/DcBaseAssetTargetExpand.java
  4. 7
      lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java
  5. 13
      lzbi-module/src/main/java/com/lzbi/targetFolder/service/DcBaseAssetTargetService.java
  6. 106
      lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml

13
lzbi-module/src/main/java/com/lzbi/asset/controller/DcBaseParamModelController.java

@ -12,6 +12,7 @@ import com.lzbi.common.enums.BusinessType;
import com.lzbi.common.utils.DateUtils; import com.lzbi.common.utils.DateUtils;
import com.lzbi.common.utils.poi.ExcelUtil; import com.lzbi.common.utils.poi.ExcelUtil;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
@ -191,5 +192,17 @@ public class DcBaseParamModelController extends BaseController
return toAjax(dcBaseParamModelService.updateBatchById(dcBaseParamModelList)); return toAjax(dcBaseParamModelService.updateBatchById(dcBaseParamModelList));
} }
/**
* 分页列表查询
* @return 分页数据
*/
@PreAuthorize("@ss.hasPermi('asset:paramModel:list')")
@GetMapping("/listNoPage")
public AjaxResult listNoPage(DcBaseParamModel dcBaseParamModel)
{
List<DcBaseParamModel> list = dcBaseParamModelService.selectByVo(dcBaseParamModel);
return AjaxResult.success(list);
}
} }

27
lzbi-module/src/main/java/com/lzbi/targetFolder/controller/DcBaseAssetTargetController.java

@ -1,7 +1,8 @@
package com.lzbi.targetFolder.controller; package com.lzbi.targetFolder.controller;
import java.util.ArrayList; import java.util.*;
import java.util.List; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
@ -9,6 +10,7 @@ import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.lzbi.common.utils.DateUtils; import com.lzbi.common.utils.DateUtils;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
import com.lzbi.targetFolder.domain.DcBaseAssetTargetExpand;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -184,6 +186,25 @@ public class DcBaseAssetTargetController extends BaseController
return toAjax(dcBaseAssetTargetService.updateBatchById(beanList)); return toAjax(dcBaseAssetTargetService.updateBatchById(beanList));
} }
/**
* 查询资产指标配置列表
*/
@PreAuthorize("@ss.hasPermi('target:target:list')")
@GetMapping("/listUsedModel")
public AjaxResult listUsedModel(DcBaseAssetTargetExpand dcBaseAssetTarget) {
List<DcBaseAssetTargetExpand> list = dcBaseAssetTargetService.selectDcBaseAssetTargetExpandList(dcBaseAssetTarget);
// 去重
List<DcBaseAssetTargetExpand> distinctList = list.stream()
.collect(Collectors.collectingAndThen(
Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(DcBaseAssetTargetExpand::getFieldCode)
.thenComparing(DcBaseAssetTargetExpand::getTargetModelCode))),
ArrayList::new));
// 分组
Map<String, List<DcBaseAssetTargetExpand>> groupedMap = distinctList.stream()
.collect(Collectors.groupingBy(DcBaseAssetTargetExpand::getFieldCode));
return AjaxResult.success(groupedMap);
}
} }

27
lzbi-module/src/main/java/com/lzbi/targetFolder/domain/DcBaseAssetTargetExpand.java

@ -0,0 +1,27 @@
package com.lzbi.targetFolder.domain;
import com.lzbi.common.annotation.Excel;
import com.lzbi.module.base.BaseModuleEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
/**
* 资产指标配置对象 dc_base_asset_target
*
* @author Lu.JL
* @date 2023-12-19
*/
@Data
@Accessors(chain = true)
public class DcBaseAssetTargetExpand extends DcBaseAssetTarget
{
private static final long serialVersionUID = 1L;
private String modelName;
private String modelValue;
}

7
lzbi-module/src/main/java/com/lzbi/targetFolder/mapper/DcBaseAssetTargetMapper.java

@ -4,6 +4,7 @@ import java.util.List;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lzbi.targetFolder.domain.DcBaseAssetTargetExpand;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -73,4 +74,10 @@ public interface DcBaseAssetTargetMapper extends BaseMapper<DcBaseAssetTarget>
* @return 结果 * @return 结果
*/ */
public int deleteDcBaseAssetTargetByIds(Long[] ids); public int deleteDcBaseAssetTargetByIds(Long[] ids);
public List<DcBaseAssetTargetExpand> selectDcBaseAssetTargetExpandList(DcBaseAssetTargetExpand dcBaseAssetTargetExpand);
} }

13
lzbi-module/src/main/java/com/lzbi/targetFolder/service/DcBaseAssetTargetService.java

@ -4,6 +4,7 @@ import java.util.List;
import com.lzbi.common.utils.DateUtils; import com.lzbi.common.utils.DateUtils;
import com.lzbi.targetFolder.domain.DcBaseAssetTarget; import com.lzbi.targetFolder.domain.DcBaseAssetTarget;
import com.lzbi.targetFolder.domain.DcBaseAssetTargetExpand;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper; import com.lzbi.targetFolder.mapper.DcBaseAssetTargetMapper;
@ -92,4 +93,16 @@ public class DcBaseAssetTargetService extends ServiceImpl<DcBaseAssetTargetMappe
{ {
return dcBaseAssetTargetMapper.deleteDcBaseAssetTargetById(id); return dcBaseAssetTargetMapper.deleteDcBaseAssetTargetById(id);
} }
/**
* 查询资产指标配置列表
*
* @param dcBaseAssetTarget 资产指标配置
* @return 资产指标配置
*/
public List<DcBaseAssetTargetExpand> selectDcBaseAssetTargetExpandList(DcBaseAssetTargetExpand dcBaseAssetTargetExpand)
{
return dcBaseAssetTargetMapper.selectDcBaseAssetTargetExpandList(dcBaseAssetTargetExpand);
}
} }

106
lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml

@ -35,6 +35,39 @@
<result property="userId" column="user_id" /> <result property="userId" column="user_id" />
</resultMap> </resultMap>
<resultMap type="com.lzbi.targetFolder.domain.DcBaseAssetTargetExpand" id="DcBaseAssetTargetExpandResult">
<result property="id" column="id" />
<result property="assetCode" column="asset_code" />
<result property="assetId" column="asset_id" />
<result property="targetModelCode" column="target_model_code" />
<result property="targetName" column="target_name" />
<result property="targetNameAlias" column="target_name_alias" />
<result property="targetCode" column="target_code" />
<result property="fieldCode" column="field_code" />
<result property="limitUp" column="limit_up" />
<result property="limitDown" column="limit_down" />
<result property="valueBase" column="value_base" />
<result property="flagAvg" column="flag_avg" />
<result property="flagSum" column="flag_sum" />
<result property="flagCompute" column="flag_compute" />
<result property="tenantId" column="tenant_id" />
<result property="revision" column="revision" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="deleteBy" column="delete_by" />
<result property="deleteTime" column="delete_time" />
<result property="sort" column="sort" />
<result property="fieldName" column="field_name" />
<result property="columnType" column="column_type" />
<result property="fieldUnit" column="field_unit" />
<result property="deptId" column="dept_id" />
<result property="userId" column="user_id" />
<result property="modelName" column="model_name" />
<result property="modelValue" column="model_value" />
</resultMap>
<sql id="selectDcBaseAssetTargetVo"> <sql id="selectDcBaseAssetTargetVo">
select id, asset_code, asset_id, target_model_code, target_name, target_name_alias, target_code, field_code, limit_up, limit_down, value_base, flag_avg, flag_sum, flag_compute, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, sort, field_name, column_type, field_unit, dept_id, user_id from dc_base_asset_target select id, asset_code, asset_id, target_model_code, target_name, target_name_alias, target_code, field_code, limit_up, limit_down, value_base, flag_avg, flag_sum, flag_compute, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, sort, field_name, column_type, field_unit, dept_id, user_id from dc_base_asset_target
</sql> </sql>
@ -182,4 +215,77 @@
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectDcBaseAssetTargetExpandList" resultMap="DcBaseAssetTargetExpandResult">
SELECT
t_table.id,
t_table.asset_code,
t_table.asset_id,
t_table.target_model_code,
t_table.target_name,
t_table.target_name_alias,
t_table.target_code,
t_table.field_code,
t_table.limit_up,
t_table.limit_down,
t_table.value_base,
t_table.flag_avg,
t_table.flag_sum,
t_table.flag_compute,
t_table.tenant_id,
t_table.revision,
t_table.created_by,
t_table.created_time,
t_table.updated_by,
t_table.updated_time,
t_table.delete_by,
t_table.delete_time,
t_table.sort,
t_table.field_name,
t_table.column_type,
t_table.field_unit,
t_table.dept_id,
t_table.user_id,
CASE
WHEN (t_model.target_model_code IS NOT NULL AND t_model.target_model_code != '') THEN t_model.target_model_name
ELSE p_model.param_model_name
END AS model_name,
t_table.target_model_code AS model_value
FROM
dc_base_asset_target t_table
LEFT JOIN
dc_base_param_model p_model ON p_model.param_model_code = t_table.target_model_code
AND p_model.flag_status = 1
LEFT JOIN
dc_base_target_model t_model ON t_model.target_model_code = t_table.target_model_code
<where>
(p_model.param_model_code IS NOT NULL
OR t_model.target_model_code IS NOT NULL )
<if test="assetCode != null and assetCode != ''"> and t_table.asset_code = #{assetCode}</if>
<if test="assetId != null"> and t_table.asset_id = #{assetId}</if>
<if test="targetModelCode != null and targetModelCode != ''"> and t_table.target_model_code = #{targetModelCode}</if>
<if test="targetName != null and targetName != ''"> and t_table.target_name like concat('%', #{targetName}, '%')</if>
<if test="targetNameAlias != null and targetNameAlias != ''"> and t_table.target_name_alias = #{targetNameAlias}</if>
<if test="targetCode != null and targetCode != ''"> and t_table.target_code = #{targetCode}</if>
<if test="fieldCode != null and fieldCode != ''"> and t_table.field_code = #{fieldCode}</if>
<if test="limitUp != null"> and t_table.limit_up = #{limitUp}</if>
<if test="limitDown != null"> and t_table.limit_down = #{limitDown}</if>
<if test="valueBase != null"> and t_table.value_base = #{valueBase}</if>
<if test="flagAvg != null and flagAvg != ''"> and t_table.flag_avg = #{flagAvg}</if>
<if test="flagSum != null and flagSum != ''"> and t_table.flag_sum = #{flagSum}</if>
<if test="flagCompute != null and flagCompute != ''"> and t_table.flag_compute = #{flagCompute}</if>
<if test="sort != null and sort != ''"> and t_table.sort = #{sort}</if>
<if test="fieldName != null and fieldName != ''"> and t_table.field_name like concat('%', #{fieldName}, '%')</if>
<if test="columnType != null and columnType != ''"> and t_table.column_type = #{columnType}</if>
<if test="fieldUnit != null and fieldUnit != ''"> and t_table.field_unit = #{fieldUnit}</if>
<if test="deptId != null"> and t_table.dept_id = #{deptId}</if>
<if test="userId != null"> and t_table.user_id = #{userId}</if>
<if test="modelName != null and modelName != ''">
and (
p_model.param_model_name like concat('%', #{modelName}, '%')
or t_model.target_model_name like concat('%', #{modelName}, '%')
</if>
</where>
</select>
</mapper> </mapper>
Loading…
Cancel
Save