1.0.8 模板变量、打印模板
parent
fd7ee66ea9
commit
e74cb5bad1
@ -0,0 +1,116 @@
|
||||
package org.dromara.oa.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.oa.base.domain.vo.BasePrintTemplateVo;
|
||||
import org.dromara.oa.base.domain.bo.BasePrintTemplateBo;
|
||||
import org.dromara.oa.base.service.IBasePrintTemplateService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 打印模板信息
|
||||
* 前端访问路由地址为:/oa/base/printTemplate
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/base/printTemplate")
|
||||
public class BasePrintTemplateController extends BaseController {
|
||||
|
||||
private final IBasePrintTemplateService basePrintTemplateService;
|
||||
|
||||
/**
|
||||
* 查询打印模板信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BasePrintTemplateVo> list(BasePrintTemplateBo bo, PageQuery pageQuery) {
|
||||
return basePrintTemplateService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出打印模板信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:export")
|
||||
@Log(title = "打印模板信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BasePrintTemplateBo bo, HttpServletResponse response) {
|
||||
List<BasePrintTemplateVo> list = basePrintTemplateService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "打印模板信息", BasePrintTemplateVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取打印模板信息详细信息
|
||||
*
|
||||
* @param templateId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:query")
|
||||
@GetMapping("/{templateId}")
|
||||
public R<BasePrintTemplateVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("templateId") Long templateId) {
|
||||
return R.ok(basePrintTemplateService.queryById(templateId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增打印模板信息
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:add")
|
||||
@Log(title = "打印模板信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BasePrintTemplateBo bo) {
|
||||
return toAjax(basePrintTemplateService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打印模板信息
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:edit")
|
||||
@Log(title = "打印模板信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BasePrintTemplateBo bo) {
|
||||
return toAjax(basePrintTemplateService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除打印模板信息
|
||||
*
|
||||
* @param templateIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa/base:printTemplate:remove")
|
||||
@Log(title = "打印模板信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{templateIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("templateIds") Long[] templateIds) {
|
||||
return toAjax(basePrintTemplateService.deleteWithValidByIds(List.of(templateIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询打印模板信息列表
|
||||
*/
|
||||
@GetMapping("/getBasePrintTemplateList")
|
||||
public R<List<BasePrintTemplateVo>> getBasePrintTemplateList(BasePrintTemplateBo bo) {
|
||||
List<BasePrintTemplateVo> list = basePrintTemplateService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package org.dromara.oa.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.oa.base.domain.vo.BaseTemplateVariableVo;
|
||||
import org.dromara.oa.base.domain.bo.BaseTemplateVariableBo;
|
||||
import org.dromara.oa.base.service.IBaseTemplateVariableService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 模板变量信息
|
||||
* 前端访问路由地址为:/oa/base/templateVariable
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/base/templateVariable")
|
||||
public class BaseTemplateVariableController extends BaseController {
|
||||
|
||||
private final IBaseTemplateVariableService baseTemplateVariableService;
|
||||
|
||||
/**
|
||||
* 查询模板变量信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<BaseTemplateVariableVo> list(BaseTemplateVariableBo bo, PageQuery pageQuery) {
|
||||
return baseTemplateVariableService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出模板变量信息列表
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:export")
|
||||
@Log(title = "模板变量信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(BaseTemplateVariableBo bo, HttpServletResponse response) {
|
||||
List<BaseTemplateVariableVo> list = baseTemplateVariableService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "模板变量信息", BaseTemplateVariableVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板变量信息详细信息
|
||||
*
|
||||
* @param variableId 主键
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:query")
|
||||
@GetMapping("/{variableId}")
|
||||
public R<BaseTemplateVariableVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("variableId") Long variableId) {
|
||||
return R.ok(baseTemplateVariableService.queryById(variableId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板变量信息
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:add")
|
||||
@Log(title = "模板变量信息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody BaseTemplateVariableBo bo) {
|
||||
return toAjax(baseTemplateVariableService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板变量信息
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:edit")
|
||||
@Log(title = "模板变量信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody BaseTemplateVariableBo bo) {
|
||||
return toAjax(baseTemplateVariableService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板变量信息
|
||||
*
|
||||
* @param variableIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("oa/base:templateVariable:remove")
|
||||
@Log(title = "模板变量信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{variableIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("variableIds") Long[] variableIds) {
|
||||
return toAjax(baseTemplateVariableService.deleteWithValidByIds(List.of(variableIds), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉框查询模板变量信息列表
|
||||
*/
|
||||
@GetMapping("/getBaseTemplateVariableList")
|
||||
public R<List<BaseTemplateVariableVo>> getBaseTemplateVariableList(BaseTemplateVariableBo bo) {
|
||||
List<BaseTemplateVariableVo> list = baseTemplateVariableService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package org.dromara.oa.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.oa.base.domain.BasePrintTemplate;
|
||||
import org.dromara.oa.base.domain.vo.BasePrintTemplateVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 打印模板信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
public interface BasePrintTemplateMapper extends BaseMapperPlus<BasePrintTemplate, BasePrintTemplateVo> {
|
||||
|
||||
/**
|
||||
* 查询打印模板信息列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 条件
|
||||
* @return 打印模板信息集合
|
||||
*/
|
||||
public Page<BasePrintTemplateVo> selectCustomBasePrintTemplateVoList(@Param("page") Page<BasePrintTemplateVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<BasePrintTemplate> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询打印模板信息列表
|
||||
*
|
||||
* @param queryWrapper 条件
|
||||
* @return 打印模板信息集合
|
||||
*/
|
||||
public List<BasePrintTemplateVo> selectCustomBasePrintTemplateVoList(@Param(Constants.WRAPPER) MPJLambdaWrapper<BasePrintTemplate> queryWrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package org.dromara.oa.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.oa.base.domain.BaseTemplateVariable;
|
||||
import org.dromara.oa.base.domain.vo.BaseTemplateVariableVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 模板变量信息Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
public interface BaseTemplateVariableMapper extends BaseMapperPlus<BaseTemplateVariable, BaseTemplateVariableVo> {
|
||||
|
||||
/**
|
||||
* 查询模板变量信息列表
|
||||
*
|
||||
* @param page 分页
|
||||
* @param queryWrapper 条件
|
||||
* @return 模板变量信息集合
|
||||
*/
|
||||
public Page<BaseTemplateVariableVo> selectCustomBaseTemplateVariableVoList(@Param("page") Page<BaseTemplateVariableVo> page, @Param(Constants.WRAPPER) MPJLambdaWrapper<BaseTemplateVariable> queryWrapper);
|
||||
|
||||
/**
|
||||
* 查询模板变量信息列表
|
||||
*
|
||||
* @param queryWrapper 条件
|
||||
* @return 模板变量信息集合
|
||||
*/
|
||||
public List<BaseTemplateVariableVo> selectCustomBaseTemplateVariableVoList(@Param(Constants.WRAPPER) MPJLambdaWrapper<BaseTemplateVariable> queryWrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.oa.base.service;
|
||||
|
||||
import org.dromara.oa.base.domain.BasePrintTemplate;
|
||||
import org.dromara.oa.base.domain.vo.BasePrintTemplateVo;
|
||||
import org.dromara.oa.base.domain.bo.BasePrintTemplateBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 打印模板信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
public interface IBasePrintTemplateService {
|
||||
|
||||
/**
|
||||
* 查询打印模板信息
|
||||
*
|
||||
* @param templateId 主键
|
||||
* @return 打印模板信息
|
||||
*/
|
||||
BasePrintTemplateVo queryById(Long templateId);
|
||||
|
||||
/**
|
||||
* 分页查询打印模板信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 打印模板信息分页列表
|
||||
*/
|
||||
TableDataInfo<BasePrintTemplateVo> queryPageList(BasePrintTemplateBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的打印模板信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 打印模板信息列表
|
||||
*/
|
||||
List<BasePrintTemplateVo> queryList(BasePrintTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 新增打印模板信息
|
||||
*
|
||||
* @param bo 打印模板信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BasePrintTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 修改打印模板信息
|
||||
*
|
||||
* @param bo 打印模板信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BasePrintTemplateBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除打印模板信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package org.dromara.oa.base.service;
|
||||
|
||||
import org.dromara.oa.base.domain.BaseTemplateVariable;
|
||||
import org.dromara.oa.base.domain.vo.BaseTemplateVariableVo;
|
||||
import org.dromara.oa.base.domain.bo.BaseTemplateVariableBo;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 模板变量信息Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
public interface IBaseTemplateVariableService {
|
||||
|
||||
/**
|
||||
* 查询模板变量信息
|
||||
*
|
||||
* @param variableId 主键
|
||||
* @return 模板变量信息
|
||||
*/
|
||||
BaseTemplateVariableVo queryById(Long variableId);
|
||||
|
||||
/**
|
||||
* 分页查询模板变量信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 模板变量信息分页列表
|
||||
*/
|
||||
TableDataInfo<BaseTemplateVariableVo> queryPageList(BaseTemplateVariableBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的模板变量信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 模板变量信息列表
|
||||
*/
|
||||
List<BaseTemplateVariableVo> queryList(BaseTemplateVariableBo bo);
|
||||
|
||||
/**
|
||||
* 新增模板变量信息
|
||||
*
|
||||
* @param bo 模板变量信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(BaseTemplateVariableBo bo);
|
||||
|
||||
/**
|
||||
* 修改模板变量信息
|
||||
*
|
||||
* @param bo 模板变量信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(BaseTemplateVariableBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除模板变量信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,136 @@
|
||||
package org.dromara.oa.base.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.oa.base.domain.bo.BasePrintTemplateBo;
|
||||
import org.dromara.oa.base.domain.vo.BasePrintTemplateVo;
|
||||
import org.dromara.oa.base.domain.BasePrintTemplate;
|
||||
import org.dromara.oa.base.mapper.BasePrintTemplateMapper;
|
||||
import org.dromara.oa.base.service.IBasePrintTemplateService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 打印模板信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BasePrintTemplateServiceImpl implements IBasePrintTemplateService {
|
||||
|
||||
private final BasePrintTemplateMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询打印模板信息
|
||||
*
|
||||
* @param templateId 主键
|
||||
* @return 打印模板信息
|
||||
*/
|
||||
@Override
|
||||
public BasePrintTemplateVo queryById(Long templateId){
|
||||
return baseMapper.selectVoById(templateId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询打印模板信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 打印模板信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BasePrintTemplateVo> queryPageList(BasePrintTemplateBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<BasePrintTemplate> lqw = buildQueryWrapper(bo);
|
||||
Page<BasePrintTemplateVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的打印模板信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 打印模板信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BasePrintTemplateVo> queryList(BasePrintTemplateBo bo) {
|
||||
MPJLambdaWrapper<BasePrintTemplate> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BasePrintTemplate> buildQueryWrapper(BasePrintTemplateBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BasePrintTemplate> lqw = JoinWrappers.lambda(BasePrintTemplate.class)
|
||||
.selectAll(BasePrintTemplate.class)
|
||||
.like(StringUtils.isNotBlank(bo.getTemplateName()), BasePrintTemplate::getTemplateName, bo.getTemplateName())
|
||||
.eq(StringUtils.isNotBlank(bo.getTemplateType()), BasePrintTemplate::getTemplateType, bo.getTemplateType())
|
||||
.eq(StringUtils.isNotBlank(bo.getTemplateStatus()), BasePrintTemplate::getTemplateStatus, bo.getTemplateStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getFlowStatus()), BasePrintTemplate::getFlowStatus, bo.getFlowStatus())
|
||||
.eq(StringUtils.isNotBlank(bo.getTemplateData()), BasePrintTemplate::getTemplateData, bo.getTemplateData())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BasePrintTemplate::getActiveFlag, bo.getActiveFlag())
|
||||
;
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增打印模板信息
|
||||
*
|
||||
* @param bo 打印模板信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BasePrintTemplateBo bo) {
|
||||
BasePrintTemplate add = MapstructUtils.convert(bo, BasePrintTemplate.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setTemplateId(add.getTemplateId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改打印模板信息
|
||||
*
|
||||
* @param bo 打印模板信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BasePrintTemplateBo bo) {
|
||||
BasePrintTemplate update = MapstructUtils.convert(bo, BasePrintTemplate.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BasePrintTemplate entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除打印模板信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
package org.dromara.oa.base.service.impl;
|
||||
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.toolkit.JoinWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.oa.base.domain.bo.BaseTemplateVariableBo;
|
||||
import org.dromara.oa.base.domain.vo.BaseTemplateVariableVo;
|
||||
import org.dromara.oa.base.domain.BaseTemplateVariable;
|
||||
import org.dromara.oa.base.mapper.BaseTemplateVariableMapper;
|
||||
import org.dromara.oa.base.service.IBaseTemplateVariableService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 模板变量信息Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2025-10-09
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class BaseTemplateVariableServiceImpl implements IBaseTemplateVariableService {
|
||||
|
||||
private final BaseTemplateVariableMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询模板变量信息
|
||||
*
|
||||
* @param variableId 主键
|
||||
* @return 模板变量信息
|
||||
*/
|
||||
@Override
|
||||
public BaseTemplateVariableVo queryById(Long variableId){
|
||||
return baseMapper.selectVoById(variableId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询模板变量信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 模板变量信息分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<BaseTemplateVariableVo> queryPageList(BaseTemplateVariableBo bo, PageQuery pageQuery) {
|
||||
MPJLambdaWrapper<BaseTemplateVariable> lqw = buildQueryWrapper(bo);
|
||||
Page<BaseTemplateVariableVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的模板变量信息列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 模板变量信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<BaseTemplateVariableVo> queryList(BaseTemplateVariableBo bo) {
|
||||
MPJLambdaWrapper<BaseTemplateVariable> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private MPJLambdaWrapper<BaseTemplateVariable> buildQueryWrapper(BaseTemplateVariableBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
MPJLambdaWrapper<BaseTemplateVariable> lqw = JoinWrappers.lambda(BaseTemplateVariable.class)
|
||||
.selectAll(BaseTemplateVariable.class)
|
||||
.eq(StringUtils.isNotBlank(bo.getVarLabel()), BaseTemplateVariable::getVarLabel, bo.getVarLabel())
|
||||
.like(StringUtils.isNotBlank(bo.getVarName()), BaseTemplateVariable::getVarName, bo.getVarName())
|
||||
.eq(StringUtils.isNotBlank(bo.getTemplateType()), BaseTemplateVariable::getTemplateType, bo.getTemplateType())
|
||||
.eq(StringUtils.isNotBlank(bo.getDataSource()), BaseTemplateVariable::getDataSource, bo.getDataSource())
|
||||
.eq(StringUtils.isNotBlank(bo.getDataField()), BaseTemplateVariable::getDataField, bo.getDataField())
|
||||
.eq(StringUtils.isNotBlank(bo.getVarType()), BaseTemplateVariable::getVarType, bo.getVarType())
|
||||
.eq(StringUtils.isNotBlank(bo.getDefaultValue()), BaseTemplateVariable::getDefaultValue, bo.getDefaultValue())
|
||||
.eq(bo.getSortOrder() != null, BaseTemplateVariable::getSortOrder, bo.getSortOrder())
|
||||
.eq(bo.getTemplateId() != null, BaseTemplateVariable::getTemplateId, bo.getTemplateId())
|
||||
.eq(StringUtils.isNotBlank(bo.getActiveFlag()), BaseTemplateVariable::getActiveFlag, bo.getActiveFlag())
|
||||
;
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增模板变量信息
|
||||
*
|
||||
* @param bo 模板变量信息
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(BaseTemplateVariableBo bo) {
|
||||
BaseTemplateVariable add = MapstructUtils.convert(bo, BaseTemplateVariable.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setVariableId(add.getVariableId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改模板变量信息
|
||||
*
|
||||
* @param bo 模板变量信息
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(BaseTemplateVariableBo bo) {
|
||||
BaseTemplateVariable update = MapstructUtils.convert(bo, BaseTemplateVariable.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(BaseTemplateVariable entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除模板变量信息信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
<?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="org.dromara.oa.base.mapper.BasePrintTemplateMapper">
|
||||
<resultMap type="org.dromara.oa.base.domain.vo.BasePrintTemplateVo" id="BasePrintTemplateResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomBasePrintTemplateVoList" resultMap="BasePrintTemplateResult">
|
||||
select template_id,
|
||||
tenant_id,
|
||||
template_name,
|
||||
version,
|
||||
template_type,
|
||||
template_status,
|
||||
flow_status,
|
||||
template_data,
|
||||
remark,
|
||||
active_flag,
|
||||
del_flag,
|
||||
create_dept,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time
|
||||
from base_print_template t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,14 @@
|
||||
<?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="org.dromara.oa.base.mapper.BaseTemplateVariableMapper">
|
||||
<resultMap type="org.dromara.oa.base.domain.vo.BaseTemplateVariableVo" id="BaseTemplateVariableResult">
|
||||
</resultMap>
|
||||
|
||||
<select id="selectCustomBaseTemplateVariableVoList" resultMap="BaseTemplateVariableResult">
|
||||
select variable_id, tenant_id, var_label, var_name, template_type, data_source, data_field, var_type, default_value, sort_order, template_id, remark, active_flag, del_flag, create_dept, create_by, create_time, update_by, update_time from base_template_variable t
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue