导出修改

main
dongdingding 3 months ago
parent fac1eabcfd
commit 1a6421aaba

@ -23,8 +23,11 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
/**
* (BPlanEnterprise)
@ -68,9 +71,22 @@ public class BPlanEnterpriseController extends BaseController {
@ApiOperation(value = "查询首页", response = BPlanEnterPriseTreeResponse.class)
@GetMapping("/tree")
public AjaxResult tree(BPlanEnterprisePageRequest req) {
return success(bPlanEnterpriseService.getShouyeList(req));
//统计完成执法cd完成执法
List<BPlanEnterPriseTreeResponse> ymList = bPlanEnterpriseService.getShouyeList(req);
//统计执法计划 cd执法计划 只受年份影响
List<BPlanEnterPriseTreeResponse> yList = bPlanEnterpriseService.getShouyeYList(req);
for (BPlanEnterPriseTreeResponse yItem : yList) {
Optional<BPlanEnterPriseTreeResponse> matchedItem = ymList.stream()
.filter(ymItem -> ymItem.getLawAreas().equals(yItem.getLawAreas()))
.findFirst();
matchedItem.ifPresent(ymItem -> {
// 合并字段的值
ymItem.setCount(yItem.getCount());
ymItem.setCdExecutionPlan(yItem.getCdExecutionPlan());
});
}
return success(ymList);
}
/**
@ -79,9 +95,49 @@ public class BPlanEnterpriseController extends BaseController {
@ApiOperation(value = "首页导出")
@PostMapping("/exportpage")
public void exportpage(HttpServletResponse response, BPlanEnterprisePageRequest req) {
List<BPlanEnterPriseTreeResponse> list = bPlanEnterpriseService.getShouyeList(req);
//统计完成执法cd完成执法
List<BPlanEnterPriseTreeResponse> ymList = bPlanEnterpriseService.getShouyeList(req);
//统计执法计划 cd执法计划 只受年份影响
List<BPlanEnterPriseTreeResponse> yList = bPlanEnterpriseService.getShouyeYList(req);
for (BPlanEnterPriseTreeResponse yItem : yList) {
Optional<BPlanEnterPriseTreeResponse> matchedItem = ymList.stream()
.filter(ymItem -> ymItem.getLawAreas().equals(yItem.getLawAreas()))
.findFirst();
matchedItem.ifPresent(ymItem -> {
// 合并字段的值
ymItem.setCount(yItem.getCount());
ymItem.setCdExecutionPlan(yItem.getCdExecutionPlan());
int finish = ymItem.getCdFinish();
int executionPlan = ymItem.getCdExecutionPlan();
// 检查除数是否为零
if (executionPlan != 0) {
// 使用 BigDecimal 进行除法计算并保留两位小数
double completionRate = (double) finish / executionPlan;
DecimalFormat df = new DecimalFormat("0.00%");
// 将计算后的结果转换为百分数形式
String formattedPercentage = df.format(completionRate);
// 将格式化后的百分数设置回 ymItem 对象
ymItem.setCdCompletionRate(formattedPercentage);
} else {
// 处理除数为零的情况
ymItem.setCdCompletionRate("0%"); // 或者设置为其他默认值或者特定的标识符
}
int completed = ymItem.getCompleted();
int count = ymItem.getCount();
if (count != 0) {
double completionRate1 = (double) completed / count;
DecimalFormat df = new DecimalFormat("0.00%");
String formattedPercentage1 = df.format(completionRate1);
ymItem.setCompletionRate(formattedPercentage1);
} else {
ymItem.setCompletionRate("0%");
}
});
}
ExcelUtil<BPlanEnterPriseTreeResponse> util = new ExcelUtil<BPlanEnterPriseTreeResponse>(BPlanEnterPriseTreeResponse.class);
util.exportExcel(response, list, "行政区划数据");
util.exportExcel(response, ymList, "行政区划数据");
}

@ -37,14 +37,14 @@ public class BPlanEnterPriseTreeResponse {
*/
@Excel(name = "CD完成率")
@ApiModelProperty("CD完成率")
private double cdCompletionRate;
private String cdCompletionRate;
/**
*
*/
@ApiModelProperty(value = "排序")
private String sort;
private Integer sort;
/**
*
*/
@ -64,7 +64,7 @@ public class BPlanEnterPriseTreeResponse {
*/
@Excel(name = "百分比")
@ApiModelProperty("百分比")
private double completionRate;
private String completionRate;
}

@ -85,7 +85,7 @@ public interface BPlanEnterpriseMapper extends BaseMapper<BPlanEnterprise> {
/**
*
* cd
*
* @param req
* @return
@ -94,7 +94,7 @@ public interface BPlanEnterpriseMapper extends BaseMapper<BPlanEnterprise> {
/**
*
* cd
*
* @param req
* @return
@ -102,6 +102,27 @@ public interface BPlanEnterpriseMapper extends BaseMapper<BPlanEnterprise> {
List<BPlanEnterPriseTreeResponse> getShouYeMxList(@Param("req") BPlanEnterprisePageRequest req);
/**
* cd
*
* @param req
* @return
*/
List<BPlanEnterPriseTreeResponse> getShouYeMxYList(@Param("req") BPlanEnterprisePageRequest req);
/**
* cd
*
* @param req
* @return
*/
List<BPlanEnterPriseTreeResponse> getShouyeYList(@Param("req") BPlanEnterprisePageRequest req);
/**
*
*

@ -1,18 +1,23 @@
package com.ruoyi.programManagement.quartz;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.Threads;
import com.ruoyi.programManagement.entity.BEnterpriseNew;
import com.ruoyi.programManagement.entity.BPlanEnterprise;
import com.ruoyi.programManagement.mapper.BEnterpriseNewMapper;
import com.ruoyi.programManagement.service.BPlanEnterpriseService;
import com.ruoyi.programManagement.service.IBEnterpriseNewService;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
/**
*
@ -26,6 +31,8 @@ import java.util.List;
public class EnterpristQuartz {
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(EnterpristQuartz.class);
@Autowired
private BEnterpriseNewMapper bEnterpriseNewMapper;
@ -62,6 +69,7 @@ public class EnterpristQuartz {
//查询计划表中的所有数据
List<BPlanEnterprise> list = bPlanEnterpriseService.selectUpdateAll();
bPlanEnterpriseService.updateBatchById(list);
return AjaxResult.success();
}

@ -20,7 +20,6 @@ import java.util.Map;
public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
/**
*
*
@ -28,6 +27,7 @@ public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
* @return
*/
public List<BPlanEnterpriseResponse> selectBPlanEnterpriseList(BPlanEnterprise bPlanEnterprise);
/**
* planId
*
@ -42,7 +42,7 @@ public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
* @param req
* @return
*/
List<BPlanEnterpriseZhifaResponse>getZhifa (checkResultRequest req);
List<BPlanEnterpriseZhifaResponse> getZhifa(checkResultRequest req);
/**
@ -88,28 +88,39 @@ public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
/**
*
* cd
*
* @param req
* @return
*/
List<BPlanEnterPriseTreeResponse> getShouyeList(BPlanEnterprisePageRequest req);
/**
* cd
*
* @param req
* @return
*/
List<BPlanEnterPriseTreeResponse> getShouyeYList(BPlanEnterprisePageRequest req);
/**
*
*
* @param idList
*/
void updateIdList(List<String> idList);
void updateIdList(List<String> idList);
/**
*
*
* @param bPlanEnterprise
*/
void insert(BPlanEnterpriseRequest bPlanEnterprise);
/**
*
*
* @param bPlanEnterprise
*/
void updatePlan(BPlanEnterpriseRequest bPlanEnterprise);
@ -122,7 +133,7 @@ public interface BPlanEnterpriseService extends IService<BPlanEnterprise> {
List<BPlanEnterprise> selectUpdateAll();
/**
/**
*
*/
void updateEndTime();

@ -95,7 +95,7 @@ public class BPlanEnterpriseServiceImpl extends ServiceImpl<BPlanEnterpriseMappe
public List<BPlanEnterPriseTreeResponse> getShouyeList(BPlanEnterprisePageRequest req) {
List<BPlanEnterPriseTreeResponse> list = null;
if (req.getLawAreas() != null) {
list=bPlanEnterpriseMapper.getShouYeMxList(req);
list = bPlanEnterpriseMapper.getShouYeMxList(req);
} else {
list = bPlanEnterpriseMapper.getShouyeList(req);
}
@ -103,7 +103,19 @@ public class BPlanEnterpriseServiceImpl extends ServiceImpl<BPlanEnterpriseMappe
}
@Override
public void updateIdList(List<String> idList) {
public List<BPlanEnterPriseTreeResponse> getShouyeYList(BPlanEnterprisePageRequest req) {
List<BPlanEnterPriseTreeResponse> list = null;
if (req.getLawAreas() != null) {
list = bPlanEnterpriseMapper.getShouYeMxYList(req);
} else {
list = bPlanEnterpriseMapper.getShouyeYList(req);
}
return list;
}
@Override
public void updateIdList(List<String> idList) {
bPlanEnterpriseMapper.updateIdList(idList);
}
@ -126,7 +138,7 @@ public class BPlanEnterpriseServiceImpl extends ServiceImpl<BPlanEnterpriseMappe
@Override
public void updateEndTime() {
bPlanEnterpriseMapper.updateEndTime();
bPlanEnterpriseMapper.updateEndTime();
}
}

@ -0,0 +1,64 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
#本地
url: jdbc:mysql://localhost:3306/ying_ji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: adminadmin
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -6,24 +6,10 @@ spring:
druid:
# 主库数据源
master:
#公司远程
# url: jdbc:mysql://39.101.188.84:3307/ying_ji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: Admin123@
#本地
# url: jdbc:mysql://localhost:3306/ying_ji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: adminadmin
#远程
url: jdbc:mysql://192.167.2.56:3306/ying_ji?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC
username: root
password: Jichuang@2023
#公司本地
# url: jdbc:mysql://localhost:3307/ying_ji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: root
# password: Admin123@
# 从库数据源
slave:
# 从数据源开关/默认关闭

@ -0,0 +1,64 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
#远程
url: jdbc:mysql://192.167.2.56:3306/ying_ji?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC
username: root
password: Jichuang@2023
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -0,0 +1,64 @@
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
#公司远程
url: jdbc:mysql://39.101.188.84:3307/ying_ji?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: Admin123@
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
username:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置连接超时时间
connectTimeout: 30000
# 配置网络超时时间
socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-username: ruoyi
login-password: 123456
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

@ -148,7 +148,7 @@
FROM b_plan_enterprise a
LEFT JOIN b_key_enterprise b ON a.enterprise_id = b.ent_code
LEFT JOIN b_enterprise_new c ON a.enterprise_id = c.enterprise_id
left join b_administrative_division d on a.district=d.county_code
left join b_administrative_division d on a.district=d.county_code
<where>
<if test="req.plannedYear !=null and req.plannedYear !=''">
and a.planned_year =#{req.plannedYear}
@ -237,11 +237,11 @@
and a.planned_year =#{req.plannedYear}
</if>
<if test="req.enterpriseName !=null and req.enterpriseName!='' ">
and a.ENTERPRISE_NAME like concat('%', #{req.enterpriseName}, '%')
and a.ENTERPRISE_NAME like concat('%', #{req.enterpriseName}, '%')
</if>
</where>
group by a.id order by a.id desc
group by a.id order by a.id desc
</select>
<select id="selectById" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">
select a.id,
@ -266,18 +266,15 @@
</select>
<select id="getShouyeList"
resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse">
SELECT
SELECT
IFNULL( law_areas, '合计' ) AS lawAreas,
MAX( law_sort ) AS sort,
COUNT( law_areas ) AS count,
CASE
WHEN GROUPING(law_areas) = 1 THEN (SELECT MAX(law_sort) + 1 FROM b_plan_enterprise)
ELSE MAX(law_sort)
END AS sort,
SUM( CASE WHEN check_status = 1 THEN 1 ELSE 0 END ) AS completed,
ROUND(
100 * SUM( CASE WHEN check_status = 1 THEN 1 ELSE 0 END ) / COUNT( law_areas ),2) AS completion_rate,
SUM(
RISK_LEVEL IN ( 'C', 'D' )) AS cdExecutionPlan,
SUM(( RISK_LEVEL IN ( 'C', 'D' )) AND check_status = 1 ) AS cdFinish,
IFNULL(ROUND(100 * SUM((RISK_LEVEL IN ('C', 'D')) AND check_status = 1) / SUM(RISK_LEVEL IN ('C', 'D')), 2),0) AS cdCompletionRate
FROM
SUM(( RISK_LEVEL IN ( 'C', 'D' )) AND check_status = 1 ) AS cdFinish
FROM
b_plan_enterprise a
LEFT JOIN b_enterprise_new b ON a.enterprise_id = b.enterprise_id
<where>
@ -292,27 +289,24 @@
</if>
and status=1
</where>
GROUP BY law_areas WITH ROLLUP
GROUP BY
law_areas WITH ROLLUP
ORDER BY
CASE WHEN GROUPING(law_areas) = 1 THEN 1 ELSE 0 END,
sort
CASE WHEN GROUPING(law_areas) = 1 THEN 1 ELSE 0 END, sort;
</select>
<select id="getShouYeMxList"
resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse">
SELECT
SELECT
IFNULL( law_hierarchy, '合计' ) AS lawAreas,
MAX( law_sort ) AS sort,
COUNT( law_areas ) AS count,
CASE
WHEN GROUPING(law_hierarchy) = 1 THEN (SELECT MAX(law_sort) + 1 FROM b_plan_enterprise)
ELSE MAX(law_sort)
END AS sort,
SUM( CASE WHEN check_status = 1 THEN 1 ELSE 0 END ) AS completed,
ROUND(
100 * SUM( CASE WHEN check_status = 1 THEN 1 ELSE 0 END ) / COUNT( law_areas ),2) AS completion_rate,
SUM(
RISK_LEVEL IN ( 'C', 'D' )) AS cdExecutionPlan,
SUM(( RISK_LEVEL IN ( 'C', 'D' )) AND check_status = 1 ) AS cdFinish,
IFNULL(ROUND(100 * SUM((RISK_LEVEL IN ('C', 'D')) AND check_status = 1) / SUM(RISK_LEVEL IN ('C', 'D')), 2),0) AS cdCompletionRate
FROM
SUM(( RISK_LEVEL IN ( 'C', 'D' )) AND check_status = 1 ) AS cdFinish
FROM
b_plan_enterprise a
LEFT JOIN b_enterprise_new b ON a.enterprise_id = b.enterprise_id
<where>
@ -328,27 +322,41 @@
<if test="req.lawAreas !=null and req.lawAreas!='' ">
and law_areas =#{req.lawAreas}
</if>
and status=1
and status=1
</where>
GROUP BY law_hierarchy WITH ROLLUP
GROUP BY
law_hierarchy WITH ROLLUP
ORDER BY
CASE WHEN GROUPING(law_hierarchy) = 1 THEN 1 ELSE 0 END,
sort
CASE WHEN GROUPING(law_hierarchy) = 1 THEN 1 ELSE 0 END, sort;
</select>
<select id="selectUpdateAll" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">
SELECT a.id, a.enterprise_id, a.district, a.planned_year, a.is_point, a.enterprise_name, a.law_sort, a.law_areas, a.law_level, a.law_hierarchy, a.planned_month, a.status,e.MAX_EXAMINE_END_TIME as check_time,
CASE
WHEN e.MAX_EXAMINE_END_TIME IS NULL THEN 0
WHEN YEAR(e.MAX_EXAMINE_END_TIME) = a.planned_year AND MONTH(e.MAX_EXAMINE_END_TIME) = a.planned_month THEN 1
SELECT a.id,
a.enterprise_id,
a.district,
a.planned_year,
a.is_point,
a.enterprise_name,
a.law_sort,
a.law_areas,
a.law_level,
a.law_hierarchy,
a.planned_month,
a.status,
e.MAX_EXAMINE_END_TIME as check_time,
CASE
WHEN e.MAX_EXAMINE_END_TIME IS NULL THEN 0
WHEN YEAR (e.MAX_EXAMINE_END_TIME) = a.planned_year AND MONTH(e.MAX_EXAMINE_END_TIME) = a.planned_month THEN 1
WHEN YEAR(e.MAX_EXAMINE_END_TIME) &lt; a.planned_year OR (YEAR(e.MAX_EXAMINE_END_TIME) = a.planned_year AND MONTH(e.MAX_EXAMINE_END_TIME) &lt; a.planned_month) THEN 2
ELSE 3
END AS check_ageing,
END
AS check_ageing,
e.ID AS check_id,
CASE
WHEN e.ID IS NOT NULL THEN 1
ELSE 0
END AS check_status
END
AS check_status
FROM b_plan_enterprise a
LEFT JOIN (
SELECT USC_CODE, MAX(EXAMINE_END_TIME) AS MAX_EXAMINE_END_TIME, ID
@ -357,6 +365,68 @@
GROUP BY USC_CODE, ID
) e ON a.enterprise_id = e.USC_CODE
</select>
<select id="getShouYeMxYList" resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse"
parameterType="com.ruoyi.programManagement.entity.request.BPlanEnterprisePageRequest">
SELECT
IFNULL(law_hierarchy, '合计') AS lawAreas,
CASE
WHEN GROUPING(law_hierarchy) = 1 THEN (SELECT MAX(law_sort) + 1 FROM b_plan_enterprise)
ELSE MAX(law_sort)
END AS sort,
COUNT(law_areas) AS count,
SUM(CASE WHEN check_status = 1 THEN 1 ELSE 0 END) AS completed,
SUM(RISK_LEVEL IN ('C', 'D')) AS cdExecutionPlan
FROM
b_plan_enterprise a
LEFT JOIN b_enterprise_new b ON a.enterprise_id = b.enterprise_id
<where>
<if test="req.plannedYear !=null and req.plannedYear!='' ">
and planned_year =#{req.plannedYear}
</if>
<if test="req.lawAreas !=null and req.lawAreas!='' ">
and law_areas =#{req.lawAreas}
</if>
and status=1
</where>
GROUP BY
law_hierarchy WITH ROLLUP
ORDER BY
CASE
WHEN GROUPING(law_hierarchy) = 1 THEN 1
ELSE 0
END,
sort;
</select>
<select id="getShouyeYList" resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse"
parameterType="com.ruoyi.programManagement.entity.request.BPlanEnterprisePageRequest">
SELECT
IFNULL(law_areas, '合计') AS lawAreas,
CASE
WHEN GROUPING(law_areas) = 1 THEN (SELECT MAX(law_sort) + 1 FROM b_plan_enterprise)
ELSE MAX(law_sort)
END AS sort,
COUNT(law_areas) AS count,
SUM(RISK_LEVEL IN ('C', 'D')) AS cdExecutionPlan
FROM
b_plan_enterprise a
LEFT JOIN b_enterprise_new b ON a.enterprise_id = b.enterprise_id
<where>
<if test="req.plannedYear !=null and req.plannedYear!='' ">
and planned_year =#{req.plannedYear}
</if>
and status=1
</where>
GROUP BY
law_areas WITH ROLLUP
ORDER BY
CASE
WHEN GROUPING(law_areas) = 1 THEN 1
ELSE 0
END,
sort;
</select>
<update id="updateIdList" parameterType="java.util.List">
UPDATE b_plan_enterprise
@ -445,7 +515,7 @@
<if test="enterpriseName != null">#{enterpriseName},</if>
<if test="lawSort != null">#{lawSort},</if>
<if test="lawAreas != null">#{lawAreas},</if>
<if test="lawLevel != null">#{lawLevel}, </if>
<if test="lawLevel != null">#{lawLevel},</if>
<if test="lawHierarchy != null">#{lawHierarchy},</if>
<if test="plannedMonth != null">#{plannedMonth},</if>
<if test="status != null">#{status},</if>

Loading…
Cancel
Save