添加功能
This commit is contained in:
@@ -16,6 +16,8 @@ public enum ModelTemplateTypeEnum {
|
||||
MODEL_WARNING_INDICATOR_DATA("劳动力动态监测系统-就业失业预警指标数据"),
|
||||
|
||||
MODEL_SUPPLY_MONITOR_POPULATION("劳动力动态监测系统-劳动力供给预测人口"),
|
||||
|
||||
MODEL_SUPPLY_MONITOR_TOTAL_FERTILITY_RATE("劳动力动态监测系统-劳动力供给预测总和生育率"),
|
||||
;
|
||||
private final String desc;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.cms.controller;
|
||||
|
||||
import com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate;
|
||||
import com.ruoyi.cms.service.ModelSupplyMonitorTotalFertilityRateService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 劳动力供给总和生育率
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/3
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/model/supplyMonitorTotalFertilityRate")
|
||||
@RequiredArgsConstructor
|
||||
public class ModelSupplyMonitorTotalFertilityRateController extends BaseController {
|
||||
|
||||
private final ModelSupplyMonitorTotalFertilityRateService modelSupplyMonitorTotalFertilityRateService;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 创建结果
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
public AjaxResult create(@Valid @RequestBody ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
modelSupplyMonitorTotalFertilityRateService.create(modelSupplyMonitorTotalFertilityRate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 更新结果
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(@Valid @RequestBody ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
modelSupplyMonitorTotalFertilityRateService.update(modelSupplyMonitorTotalFertilityRate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id ID
|
||||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping("/delete")
|
||||
public AjaxResult delete(@RequestParam Long id) {
|
||||
modelSupplyMonitorTotalFertilityRateService.delete(id);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空
|
||||
*
|
||||
* @return 清空结果
|
||||
*/
|
||||
@DeleteMapping("/clear")
|
||||
public AjaxResult clear() {
|
||||
modelSupplyMonitorTotalFertilityRateService.clear();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @param id ID
|
||||
* @return 劳动力供给总和生育率
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult detail(@RequestParam Long id) {
|
||||
ModelSupplyMonitorTotalFertilityRate data = modelSupplyMonitorTotalFertilityRateService.detail(id);
|
||||
return AjaxResult.success(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 列表
|
||||
*/
|
||||
@PostMapping("/list")
|
||||
public AjaxResult list(@RequestBody ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
List<ModelSupplyMonitorTotalFertilityRate> list =
|
||||
modelSupplyMonitorTotalFertilityRateService.list(modelSupplyMonitorTotalFertilityRate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ruoyi.cms.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 劳动力供给总和生育率
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/3
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ModelSupplyMonitorTotalFertilityRate implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 年份
|
||||
*/
|
||||
@Excel(name = "年份")
|
||||
private Integer year;
|
||||
/**
|
||||
* 总和生育率
|
||||
*/
|
||||
@Excel(name = "总和生育率")
|
||||
private BigDecimal totalFertilityRate;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
import com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 劳动力供给总和生育率
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/3
|
||||
*/
|
||||
public interface ModelSupplyMonitorTotalFertilityRateMapper {
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
*/
|
||||
void insert(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 修改
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
*/
|
||||
void update(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 通过ID删除
|
||||
*
|
||||
* @param id ID
|
||||
*/
|
||||
void deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 清空
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* 通过ID查询
|
||||
*
|
||||
* @param id ID
|
||||
* @return 劳动力供给总和生育率
|
||||
*/
|
||||
ModelSupplyMonitorTotalFertilityRate selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询唯一(按年份)
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 劳动力供给总和生育率
|
||||
*/
|
||||
ModelSupplyMonitorTotalFertilityRate findUnique(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 列表
|
||||
*/
|
||||
List<ModelSupplyMonitorTotalFertilityRate> list(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate;
|
||||
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 劳动力供给总和生育率
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/3
|
||||
*/
|
||||
public interface ModelSupplyMonitorTotalFertilityRateService {
|
||||
|
||||
/**
|
||||
* 创建
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
*/
|
||||
void create(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
*/
|
||||
void update(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id ID
|
||||
*/
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* 清空
|
||||
*/
|
||||
void clear();
|
||||
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @param id ID
|
||||
* @return 劳动力供给总和生育率
|
||||
*/
|
||||
ModelSupplyMonitorTotalFertilityRate detail(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 列表
|
||||
*/
|
||||
List<ModelSupplyMonitorTotalFertilityRate> list(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
/**
|
||||
* 导入数据
|
||||
*
|
||||
* @param file 文件
|
||||
* @return 导入结果
|
||||
*/
|
||||
String importExcel(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @param response 响应体
|
||||
* @param dto 导出参数
|
||||
*/
|
||||
void exportExcel(HttpServletResponse response, ModelExportParamDto dto);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
|
||||
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
|
||||
import com.ruoyi.cms.service.ModelCommonService;
|
||||
import com.ruoyi.cms.service.ModelSupplyMonitorPopulationService;
|
||||
import com.ruoyi.cms.service.ModelSupplyMonitorTotalFertilityRateService;
|
||||
import com.ruoyi.cms.service.ModelWarningIndicatorDataService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -36,6 +37,7 @@ public class ModelCommonServiceImpl implements ModelCommonService {
|
||||
|
||||
private final ModelWarningIndicatorDataService modelWarningIndicatorDataService;
|
||||
private final ModelSupplyMonitorPopulationService modelSupplyMonitorPopulationService;
|
||||
private final ModelSupplyMonitorTotalFertilityRateService modelSupplyMonitorTotalFertilityRateService;
|
||||
|
||||
@Override
|
||||
public void template(HttpServletResponse response,
|
||||
@@ -83,6 +85,8 @@ public class ModelCommonServiceImpl implements ModelCommonService {
|
||||
return modelWarningIndicatorDataService.importExcel(file);
|
||||
case MODEL_SUPPLY_MONITOR_POPULATION:
|
||||
return modelSupplyMonitorPopulationService.importExcel(file);
|
||||
case MODEL_SUPPLY_MONITOR_TOTAL_FERTILITY_RATE:
|
||||
return modelSupplyMonitorTotalFertilityRateService.importExcel(file);
|
||||
default:
|
||||
throw new ServiceException("模板类型错误");
|
||||
}
|
||||
@@ -101,6 +105,9 @@ public class ModelCommonServiceImpl implements ModelCommonService {
|
||||
case MODEL_SUPPLY_MONITOR_POPULATION:
|
||||
modelSupplyMonitorPopulationService.exportExcel(response, dto);
|
||||
break;
|
||||
case MODEL_SUPPLY_MONITOR_TOTAL_FERTILITY_RATE:
|
||||
modelSupplyMonitorTotalFertilityRateService.exportExcel(response, dto);
|
||||
break;
|
||||
default:
|
||||
throw new ServiceException("模板类型错误");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.constant.enums.ModelTemplateTypeEnum;
|
||||
import com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate;
|
||||
import com.ruoyi.cms.domain.dto.ModelExportParamDto;
|
||||
import com.ruoyi.cms.mapper.ModelSupplyMonitorTotalFertilityRateMapper;
|
||||
import com.ruoyi.cms.service.ModelSupplyMonitorTotalFertilityRateService;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.bean.BeanValidators;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Validator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 劳动力供给总和生育率
|
||||
*
|
||||
* @author 马宝龙
|
||||
* @date 2026/7/3
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
public class ModelSupplyMonitorTotalFertilityRateServiceImpl implements ModelSupplyMonitorTotalFertilityRateService {
|
||||
|
||||
private final ModelSupplyMonitorTotalFertilityRateMapper modelSupplyMonitorTotalFertilityRateMapper;
|
||||
private final Validator validator;
|
||||
|
||||
@Override
|
||||
public void create(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
|
||||
check(modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
// 查询唯一(按年份)
|
||||
Optional<ModelSupplyMonitorTotalFertilityRate> optional = findUnique(modelSupplyMonitorTotalFertilityRate);
|
||||
if (optional.isPresent()) {
|
||||
// 更新
|
||||
ModelSupplyMonitorTotalFertilityRate exists = optional.get();
|
||||
modelSupplyMonitorTotalFertilityRate.setId(exists.getId());
|
||||
modelSupplyMonitorTotalFertilityRateMapper.update(modelSupplyMonitorTotalFertilityRate);
|
||||
} else {
|
||||
// 新增
|
||||
modelSupplyMonitorTotalFertilityRateMapper.insert(modelSupplyMonitorTotalFertilityRate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
*/
|
||||
void check(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
if (Objects.isNull(modelSupplyMonitorTotalFertilityRate.getYear())) {
|
||||
throw new ServiceException("年份不能为空");
|
||||
}
|
||||
if (Objects.isNull(modelSupplyMonitorTotalFertilityRate.getTotalFertilityRate())) {
|
||||
throw new ServiceException("总和生育率不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
|
||||
check(modelSupplyMonitorTotalFertilityRate);
|
||||
|
||||
if (Objects.isNull(modelSupplyMonitorTotalFertilityRate.getId())) {
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
Optional<ModelSupplyMonitorTotalFertilityRate> unique = findUnique(modelSupplyMonitorTotalFertilityRate);
|
||||
if (!unique.isPresent()) {
|
||||
modelSupplyMonitorTotalFertilityRateMapper.update(modelSupplyMonitorTotalFertilityRate);
|
||||
return;
|
||||
}
|
||||
ModelSupplyMonitorTotalFertilityRate exists = unique.get();
|
||||
if (!exists.getId().equals(modelSupplyMonitorTotalFertilityRate.getId())) {
|
||||
throw new ServiceException("数据已存在");
|
||||
}
|
||||
modelSupplyMonitorTotalFertilityRateMapper.update(modelSupplyMonitorTotalFertilityRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
if (Objects.isNull(id)) {
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
modelSupplyMonitorTotalFertilityRateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
modelSupplyMonitorTotalFertilityRateMapper.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelSupplyMonitorTotalFertilityRate detail(Long id) {
|
||||
if (Objects.isNull(id)) {
|
||||
throw new ServiceException("id不能为空");
|
||||
}
|
||||
return modelSupplyMonitorTotalFertilityRateMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询唯一
|
||||
*
|
||||
* @param modelSupplyMonitorTotalFertilityRate 劳动力供给总和生育率
|
||||
* @return 劳动力供给总和生育率
|
||||
*/
|
||||
private Optional<ModelSupplyMonitorTotalFertilityRate> findUnique(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
ModelSupplyMonitorTotalFertilityRate unique =
|
||||
modelSupplyMonitorTotalFertilityRateMapper.findUnique(modelSupplyMonitorTotalFertilityRate);
|
||||
return Optional.ofNullable(unique);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ModelSupplyMonitorTotalFertilityRate> list(ModelSupplyMonitorTotalFertilityRate modelSupplyMonitorTotalFertilityRate) {
|
||||
return modelSupplyMonitorTotalFertilityRateMapper.list(modelSupplyMonitorTotalFertilityRate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importExcel(MultipartFile file) {
|
||||
try {
|
||||
ExcelUtil<ModelSupplyMonitorTotalFertilityRate> util = new ExcelUtil<>(ModelSupplyMonitorTotalFertilityRate.class);
|
||||
List<ModelSupplyMonitorTotalFertilityRate> list = util.importExcel(file.getInputStream());
|
||||
|
||||
ModelSupplyMonitorTotalFertilityRate exists;
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (ModelSupplyMonitorTotalFertilityRate item : list) {
|
||||
try {
|
||||
check(item);
|
||||
exists = modelSupplyMonitorTotalFertilityRateMapper.findUnique(item);
|
||||
if (exists == null) {
|
||||
BeanValidators.validateWithException(validator, item);
|
||||
modelSupplyMonitorTotalFertilityRateMapper.insert(item);
|
||||
successNum++;
|
||||
String msg =
|
||||
"<br/>" + successNum + "、" + "年份:" + item.getYear() + "数据导入成功。";
|
||||
successMsg.append(msg);
|
||||
} else {
|
||||
item.setId(exists.getId());
|
||||
BeanValidators.validateWithException(validator, item);
|
||||
modelSupplyMonitorTotalFertilityRateMapper.update(item);
|
||||
successNum++;
|
||||
String msg =
|
||||
"<br/>" + successNum + "、" + "年份:" + item.getYear() + "数据更新成功。";
|
||||
successMsg.append(msg);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、" + "年份:" + item.getYear() + "数据导入失败:";
|
||||
failureMsg.append(msg).append(e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据出现问题,错误如下:");
|
||||
throw new ServiceException(failureMsg.toString());
|
||||
} else {
|
||||
successMsg.insert(0, "数据已全部导入成功!共 " + successNum + " 条:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
} catch (Exception e) {
|
||||
log.error("数据导入失败", e);
|
||||
throw new ServiceException("数据导入失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportExcel(HttpServletResponse response, ModelExportParamDto dto) {
|
||||
try {
|
||||
|
||||
List<ModelSupplyMonitorTotalFertilityRate> list = list(ModelSupplyMonitorTotalFertilityRate.builder()
|
||||
.year(dto.getYear())
|
||||
.build());
|
||||
ExcelUtil<ModelSupplyMonitorTotalFertilityRate> util = new ExcelUtil<>(ModelSupplyMonitorTotalFertilityRate.class);
|
||||
util.exportExcel(response, list, ModelTemplateTypeEnum.MODEL_SUPPLY_MONITOR_TOTAL_FERTILITY_RATE.getDesc());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("数据导出失败", e);
|
||||
throw new ServiceException("数据导出失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,6 +159,7 @@ public class ModelWarningIndicatorDataServiceImpl implements ModelWarningIndicat
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (ModelWarningIndicatorData item : list) {
|
||||
try {
|
||||
check(item);
|
||||
exists = modelWarningIndicatorDataMapper.findUnique(item);
|
||||
if (exists == null) {
|
||||
BeanValidators.validateWithException(validator, item);
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?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.ruoyi.cms.mapper.ModelSupplyMonitorTotalFertilityRateMapper">
|
||||
|
||||
<insert id="insert" parameterType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate">
|
||||
INSERT INTO model_supply_monitor_total_fertility_rate (year, total_fertility_rate)
|
||||
VALUES (#{year}, #{totalFertilityRate})
|
||||
</insert>
|
||||
|
||||
<insert id="update" parameterType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate">
|
||||
UPDATE model_supply_monitor_total_fertility_rate
|
||||
SET year = #{year},
|
||||
total_fertility_rate = #{totalFertilityRate}
|
||||
WHERE id = #{id}
|
||||
</insert>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
DELETE
|
||||
FROM model_supply_monitor_total_fertility_rate
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="clear">
|
||||
DELETE FROM model_supply_monitor_total_fertility_rate
|
||||
WHERE id IS NOT NULL;
|
||||
</delete>
|
||||
|
||||
<select id="selectById" parameterType="java.lang.Long"
|
||||
resultType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate">
|
||||
SELECT id,
|
||||
year,
|
||||
total_fertility_rate AS totalFertilityRate
|
||||
FROM model_supply_monitor_total_fertility_rate
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findUnique" parameterType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate"
|
||||
resultType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate">
|
||||
SELECT id,
|
||||
year,
|
||||
total_fertility_rate AS totalFertilityRate
|
||||
FROM model_supply_monitor_total_fertility_rate
|
||||
WHERE year = #{year}
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate"
|
||||
resultType="com.ruoyi.cms.domain.ModelSupplyMonitorTotalFertilityRate">
|
||||
SELECT id,
|
||||
year,
|
||||
total_fertility_rate AS totalFertilityRate
|
||||
FROM model_supply_monitor_total_fertility_rate
|
||||
<where>
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="year != null">
|
||||
AND year = #{year}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY year DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Binary file not shown.
Binary file not shown.
@@ -901,4 +901,29 @@ COMMENT
|
||||
ON COLUMN shz_data_dashboard.model_supply_monitor_population.total_count IS '总人数';
|
||||
|
||||
COMMENT
|
||||
ON TABLE shz_data_dashboard.model_supply_monitor_population IS '劳动力供给人口';
|
||||
ON TABLE shz_data_dashboard.model_supply_monitor_population IS '劳动力供给人口';
|
||||
|
||||
|
||||
--劳动力供给总和生育率
|
||||
CREATE TABLE shz_data_dashboard.model_supply_monitor_total_fertility_rate
|
||||
(
|
||||
id serial PRIMARY KEY,
|
||||
year integer NOT NULL,
|
||||
total_fertility_rate numeric(10, 2) NOT NULL
|
||||
)
|
||||
;
|
||||
|
||||
ALTER TABLE shz_data_dashboard.model_supply_monitor_total_fertility_rate
|
||||
OWNER TO sysdba;
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.model_supply_monitor_total_fertility_rate.id IS '主键';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.model_supply_monitor_total_fertility_rate.year IS '年份';
|
||||
|
||||
COMMENT
|
||||
ON COLUMN shz_data_dashboard.model_supply_monitor_total_fertility_rate.total_fertility_rate IS '总和生育率';
|
||||
|
||||
COMMENT
|
||||
ON TABLE shz_data_dashboard.model_supply_monitor_total_fertility_rate IS '劳动力供给总和生育率';
|
||||
Reference in New Issue
Block a user