参数模板

This commit is contained in:
tangw 2025-12-23 16:11:31 +08:00
parent 9b2d5e18a0
commit 0291351702
8 changed files with 603 additions and 4 deletions

View File

@ -0,0 +1,30 @@
package com.czlis.common.core.domain.entity.lis;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ComReportDict {
private Long reportId;
private String reportType;
private String reportCode;
private String reportName;
private String reportOptiontype;
private String reportDefvalue;
private Long reportSort;
private String status;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
private String remark;
}

View File

@ -29,10 +29,10 @@ public class ComConfigDictController extends BaseController {
*/ */
@ApiOperation("获取字典列表") @ApiOperation("获取字典列表")
@GetMapping("/list") @GetMapping("/list")
public AjaxResult list(ComConfigDict post) { public TableDataInfo list(ComConfigDict post) {
// startPage(); startPage();
List<ComConfigDict> list = ComConfigDictService.selectComConfigDictList(post); List<ComConfigDict> list = ComConfigDictService.selectComConfigDictList(post);
return success(list); return getDataTable(list);
} }
@ApiOperation("字典导出") @ApiOperation("字典导出")
@Log(title = "字典导出", businessType = BusinessType.EXPORT) @Log(title = "字典导出", businessType = BusinessType.EXPORT)

View File

@ -0,0 +1,108 @@
package com.czlis.liswork.controller.xtwh;
import com.czlis.common.annotation.Log;
import com.czlis.common.core.controller.BaseController;
import com.czlis.common.core.domain.AjaxResult;
import com.czlis.common.core.domain.entity.lis.ComReportDict;
import com.czlis.common.enums.BusinessType;
import com.czlis.common.utils.poi.ExcelUtil;
import com.czlis.liswork.service.ComReportDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@Api(tags = "参数模板设置")
@RestController
@RequestMapping("/reportdict")
@Slf4j
public class ComReportDictController extends BaseController {
@Autowired
private ComReportDictService comReportDictService;
/**
* 获取字典列表
*/
@ApiOperation("获取字典列表")
@GetMapping("/list")
public AjaxResult list(ComReportDict post) {
// startPage();
List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
return success(list);
}
@ApiOperation("字典导出")
@Log(title = "字典导出", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ComReportDict post) {
List<ComReportDict> list = comReportDictService.selectComReportDictList(post);
ExcelUtil<ComReportDict> util = new ExcelUtil<>(ComReportDict.class);
util.exportExcel(response, list, "字典数据");
}
/**
* 根据字典编号获取详细信息
*/
@ApiOperation("获取详细信息")
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) {
return success(comReportDictService.selectComReportDictById(dictId));
}
/**
* 新增字典
*/
@ApiOperation("新增字典")
@Log(title = "字典管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody ComReportDict post) {
log.info("post:{}",post);
if (!comReportDictService.checkDictNameUnique(post)) {
return error("新增字典'" + post.getReportName() + "'失败,字典名称已存在");
} else if (!comReportDictService.checkDictCodeUnique(post)) {
return error("新增字典'" + post.getReportName() + "'失败,字典编码已存在");
}
post.setCreateBy(getUsername());
return toAjax(comReportDictService.insertDict(post));
}
/**
* 修改字典
*/
@ApiOperation("修改字典")
@Log(title = "字典管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody ComReportDict post) {
if (!comReportDictService.checkDictNameUnique(post)) {
return error("修改字典'" + post.getReportName() + "'失败,字典名称已存在");
} else if (!comReportDictService.checkDictCodeUnique(post)) {
return error("修改字典'" + post.getReportName() + "'失败,字典编码已存在");
}
post.setUpdateBy(getUsername());
return toAjax(comReportDictService.updateDict(post));
}
/**
* 删除字典
*/
@ApiOperation("删除字典")
@Log(title = "字典管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) {
return toAjax(comReportDictService.deleteDictByIds(dictIds));
}
/**
* 获取字典选择框列表
*/
@ApiOperation("获取字典选择框列表")
@GetMapping("/optionselect")
public AjaxResult optionselect() {
List<ComReportDict> posts = comReportDictService.selectComReportDictAll();
return success(posts);
}
}

View File

@ -0,0 +1,85 @@
package com.czlis.liswork.mapper.xtwh;
import com.czlis.common.core.domain.entity.lis.ComReportDict;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ComReportDictMapper {
Long getCountById(Long reportId);
List<ComReportDict> selectComReportDictByType(String reportType);
/**
* 查询报表模板数据集合
*
* @param Dict 报表模板信息
* @return 报表模板数据集合
*/
List<ComReportDict> selectComReportDictList(ComReportDict Dict);
/**
* 查询所有报表模板
*
* @return 报表模板列表
*/
List<ComReportDict> selectComReportDictAll();
/**
* 通过报表模板ID查询报表模板信息
*
* @param reportId 报表模板ID
* @return 角色对象信息
*/
ComReportDict selectComReportDictById(Long reportId);
/**
* 删除报表模板信息
*
* @param reportId 报表模板ID
* @return 结果
*/
int delComReportDictById(Long reportId);
/**
* 批量删除报表模板信息
*
* @param DictIds 需要删除的报表模板ID
* @return 结果
*/
int delComReportDictByIds(Long[] DictIds);
/**
* 修改报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
int updateComReportDict(ComReportDict Dict);
/**
* 新增报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
int insertComReportDict(ComReportDict Dict);
/**
* 校验报表模板名称
*
* @param reportName 报表模板名称
* @param reportType 类别
* @return 结果
*/
ComReportDict checkDictNameUnique(@Param("reportName") String reportName, @Param("reportType") String reportType);
/**
* 校验报表模板编码
*
* @param reportCode 报表模板编码
* @return 结果
*/
ComReportDict checkDictCodeUnique(@Param("reportCode") String reportCode,@Param("reportType") String reportType);
}

View File

@ -0,0 +1,87 @@
package com.czlis.liswork.service;
import com.czlis.common.core.domain.entity.lis.ComReportDict;
import java.util.List;
public interface ComReportDictService {
/**
* 查询报表模板信息集合
*
* @param Dict 报表模板信息
* @return 报表模板信息集合
*/
List<ComReportDict> selectComReportDictList(ComReportDict Dict);
/**
* 查询所有报表模板
*
* @return 报表模板列表
*/
List<ComReportDict> selectComReportDictAll();
/**
* 通过报表模板ID查询报表模板信息
*
* @param DictId 报表模板ID
* @return 角色对象信息
*/
ComReportDict selectComReportDictById(Long DictId);
/**
* 校验报表模板名称是否唯一
*
* @param Dict 报表模板信息
* @return 结果
*/
boolean checkDictNameUnique(ComReportDict Dict);
/**
* 校验报表模板编码是否唯一
*
* @param Dict 报表模板信息
* @return 结果
*/
boolean checkDictCodeUnique(ComReportDict Dict);
/**
* 通过报表模板ID查询报表模板使用数量
*
* @param DictId 报表模板ID
* @return 结果
*/
int countUserDictById(Long DictId);
/**
* 删除报表模板信息
*
* @param DictId 报表模板ID
* @return 结果
*/
int deleteDictById(Long DictId);
/**
* 批量删除报表模板信息
*
* @param DictIds 需要删除的报表模板ID
* @return 结果
*/
int deleteDictByIds(Long[] DictIds);
/**
* 新增保存报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
int insertDict(ComReportDict Dict);
/**
* 修改保存报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
int updateDict(ComReportDict Dict);
}

View File

@ -486,7 +486,9 @@ public class ReportItemServiceImpl implements ReportItemService {
XmDouble xmDouble=new XmDouble(); XmDouble xmDouble=new XmDouble();
xmDouble.setYq(yq); xmDouble.setYq(yq);
xmDouble.setXmdh(xmdh); xmDouble.setXmdh(xmdh);
return new Result("0","成功!",reportItemMapper.queryXmDouble(xmDouble)); List<XmDouble> XmDoublelist=reportItemMapper.queryXmDouble(xmDouble);
if(!XmDoublelist.isEmpty()&&XmDoublelist!=null)xmDouble=XmDoublelist.get(0);
return new Result("0","成功!",xmDouble);
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override

View File

@ -0,0 +1,150 @@
package com.czlis.liswork.service.impl.xtwh;
import com.czlis.common.constant.UserConstants;
import com.czlis.common.core.domain.entity.lis.ComReportDict;
import com.czlis.common.exception.ServiceException;
import com.czlis.common.utils.StringUtils;
import com.czlis.liswork.mapper.xtwh.ComReportDictMapper;
import com.czlis.liswork.service.ComReportDictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 配置参数报表模板,系统配置菜单依据本报表模板自动创建配置档
*/
@Service
@Slf4j
public class ComReportDictServiceImpl implements ComReportDictService {
@Autowired
ComReportDictMapper comReportDictMapper;
/**
* 查询报表模板信息集合
*
* @param Dict 报表模板信息
* @return 报表模板信息集合
*/
@Override
public List<ComReportDict> selectComReportDictList(ComReportDict Dict) {
return comReportDictMapper.selectComReportDictList(Dict);
}
/**
* 查询所有报表模板
*
* @return 报表模板列表
*/
@Override
public List<ComReportDict> selectComReportDictAll() {
return comReportDictMapper.selectComReportDictAll();
}
/**
* 通过报表模板ID查询报表模板信息
*
* @param DictId 报表模板ID
* @return 角色对象信息
*/
@Override
public ComReportDict selectComReportDictById(Long DictId) {
return comReportDictMapper.selectComReportDictById(DictId);
}
/**
* 校验报表模板名称是否唯一
*
* @param Dict 报表模板信息
* @return 结果
*/
@Override
public boolean checkDictNameUnique(ComReportDict Dict) {
Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId();
ComReportDict info = comReportDictMapper.checkDictNameUnique(Dict.getReportName(),Dict.getReportType());
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 校验报表模板编码是否唯一
*
* @param Dict 报表模板信息
* @return 结果
*/
@Override
public boolean checkDictCodeUnique(ComReportDict Dict) {
Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId();
ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode(),Dict.getReportType());
if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) {
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
* 通过报表模板ID查询报表模板使用数量
*
* @param DictId 报表模板ID
* @return 结果
*/
@Override
public int countUserDictById(Long DictId) {
return 0;//comReportDictMapper.countUserDictById(DictId);
}
/**
* 删除报表模板信息
*
* @param DictId 报表模板ID
* @return 结果
*/
@Override
public int deleteDictById(Long DictId) {
return comReportDictMapper.delComReportDictById(DictId);
}
/**
* 批量删除报表模板信息
*
* @param DictIds 需要删除的报表模板ID
* @return 结果
*/
@Override
public int deleteDictByIds(Long[] DictIds) {
for (Long DictId : DictIds) {
ComReportDict Dict = selectComReportDictById(DictId);
if (countUserDictById(DictId) > 0) {
throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getReportName()));
}
}
return comReportDictMapper.delComReportDictByIds(DictIds);
}
/**
* 新增保存报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
@Override
public int insertDict(ComReportDict Dict) {
return comReportDictMapper.insertComReportDict(Dict);
}
/**
* 修改保存报表模板信息
*
* @param Dict 报表模板信息
* @return 结果
*/
@Override
public int updateDict(ComReportDict Dict) {
return comReportDictMapper.updateComReportDict(Dict);
}
}

View File

@ -0,0 +1,137 @@
<?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.czlis.liswork.mapper.xtwh.ComReportDictMapper">
<resultMap type="com.czlis.common.core.domain.entity.lis.ComReportDict" id="ComReportDictResult">
<id property="reportId" column="report_id" />
<result property="reportType" column="report_type" />
<result property="reportCode" column="report_code" />
<result property="reportName" column="report_name" />
<result property="reportOptiontype" column="report_optiontype" />
<result property="reportDefvalue" column="report_defvalue" />
<result property="reportSort" column="report_sort" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectComReportDictVo">
select report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
status,create_by,create_time,update_by,update_time,remark from com_report_dict
</sql>
<select id="selectComReportDictList" resultMap="ComReportDictResult" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" >
<include refid="selectComReportDictVo"></include>
<where>
<if test="reportId != null and reportId != 0">
and report_id = #{reportId}
</if>
<if test="reportType != null and reportType != ''">
and report_type = #{reportType}
</if>
<if test="reportCode != null and reportCode != ''">
and report_code = #{reportCode}
</if>
<if test="reportName != null and reportName != ''">
and report_name = #{reportName}
</if>
<if test="reportOptiontype != null and reportOptiontype != ''">
and report_optiontype = #{reportOptiontype}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
order by report_sort ASC
</select>
<select id="getCountById" resultType="Long">
select count(1) from com_report_dict where report_id = #{reportId}
</select>
<select id="selectComReportDictAll" resultMap="ComReportDictResult">
<include refid="selectComReportDictVo"/>
order by report_sort
</select>
<select id="selectComReportDictById" parameterType="Long" resultMap="ComReportDictResult">
<include refid="selectComReportDictVo"/>
where report_id = #{reportId}
</select>
<select id="selectComReportDictByType" parameterType="String" resultMap="ComReportDictResult">
<include refid="selectComReportDictVo"/>
where report_type = #{reportType}
order by report_sort
</select>
<select id="checkDictNameUnique" parameterType="String" resultMap="ComReportDictResult">
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
status,create_by,create_time,update_by,update_time,remark
from com_report_dict
where report_name=#{reportName} and report_type = #{reportType}
</select>
<select id="checkDictCodeUnique" parameterType="String" resultMap="ComReportDictResult">
select top 1 report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort,
status,create_by,create_time,update_by,update_time,remark
from com_report_dict
where report_code=#{reportCode} and report_type = #{reportType}
</select>
<insert id="insertComReportDict" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict" useGeneratedKeys="true" keyProperty="reportId">
insert into com_report_dict(
<if test="reportId != null and reportId != 0">report_id,</if>
<if test="reportType != null and reportType != ''">report_type,</if>
<if test="reportCode != null and reportCode != ''">report_code,</if>
<if test="reportName != null and reportName != ''">report_name,</if>
<if test="reportOptiontype != null and reportOptiontype != ''">report_optiontype,</if>
<if test="reportDefvalue != null and reportDefvalue != ''">report_defvalue,</if>
<if test="reportSort != null">report_sort,</if>
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="reportId != null and reportId != 0">#{reportId},</if>
<if test="reportType != null and reportType != ''">#{reportType},</if>
<if test="reportCode != null and reportCode != ''">#{reportCode},</if>
<if test="reportName != null and reportName != ''">#{reportName},</if>
<if test="reportOptiontype != null and reportOptiontype != ''">#{reportOptiontype},</if>
<if test="reportDefvalue != null and reportDefvalue != ''">#{reportDefvalue},</if>
<if test="reportSort != null">#{reportSort},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
getdate()
)
</insert>
<delete id="delComReportDictById" parameterType="Long">
delete from com_report_dict where report_id = #{reportId}
</delete>
<delete id="delComReportDictByIds" parameterType="Long">
delete from com_report_dict where report_id in
<foreach collection="array" item="reportId" open="(" separator="," close=")">
#{reportId}
</foreach>
</delete>
<update id="updateComReportDict" parameterType="com.czlis.common.core.domain.entity.lis.ComReportDict">
update com_report_dict
<set>
<if test="reportType != null and reportType != ''">report_type = #{reportType},</if>
<if test="reportCode != null and reportCode != ''">report_code = #{reportCode},</if>
<if test="reportName != null and reportName != ''">report_name = #{reportName},</if>
<if test="reportOptiontype != null and reportOptiontype != ''">report_optiontype = #{reportOptiontype},</if>
<if test="reportDefvalue != null and reportDefvalue != ''">report_defvalue = #{reportDefvalue},</if>
<if test="reportSort != null">report_sort = #{reportSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = getdate()
</set>
where report_id = #{reportId}
</update>
</mapper>