forked from dyf/fys-Multi-tenant
fys
This commit is contained in:
@ -0,0 +1,18 @@
|
||||
package com.fuyuanshen.demo.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 导出下拉框Excel示例
|
||||
*
|
||||
* @author Emil.Zhang
|
||||
*/
|
||||
public interface IExportExcelService {
|
||||
|
||||
/**
|
||||
* 导出下拉框
|
||||
*
|
||||
* @param response /
|
||||
*/
|
||||
void exportWithOptions(HttpServletResponse response);
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.fuyuanshen.demo.service;
|
||||
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.demo.domain.TestDemo;
|
||||
import com.fuyuanshen.demo.domain.bo.TestDemoBo;
|
||||
import com.fuyuanshen.demo.domain.vo.TestDemoVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试单表Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2021-07-26
|
||||
*/
|
||||
public interface ITestDemoService {
|
||||
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TestDemoVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 自定义分页查询
|
||||
*/
|
||||
TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<TestDemoVo> queryList(TestDemoBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入测试单表
|
||||
*
|
||||
* @param bo 测试单表新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByBo(TestDemoBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改测试单表
|
||||
*
|
||||
* @param bo 测试单表编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByBo(TestDemoBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 批量保存
|
||||
*/
|
||||
Boolean saveBatch(List<TestDemo> list);
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.fuyuanshen.demo.service;
|
||||
|
||||
import com.fuyuanshen.demo.domain.bo.TestTreeBo;
|
||||
import com.fuyuanshen.demo.domain.vo.TestTreeVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 测试树表Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2021-07-26
|
||||
*/
|
||||
public interface ITestTreeService {
|
||||
/**
|
||||
* 查询单个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TestTreeVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<TestTreeVo> queryList(TestTreeBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入测试树表
|
||||
*
|
||||
* @param bo 测试树表新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insertByBo(TestTreeBo bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改测试树表
|
||||
*
|
||||
* @param bo 测试树表编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean updateByBo(TestTreeBo bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
*
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
package com.fuyuanshen.demo.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.fuyuanshen.common.core.constant.SystemConstants;
|
||||
import com.fuyuanshen.common.core.utils.StreamUtils;
|
||||
import com.fuyuanshen.common.excel.core.DropDownOptions;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.demo.domain.vo.ExportDemoVo;
|
||||
import com.fuyuanshen.demo.service.IExportExcelService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 导出下拉框Excel示例
|
||||
*
|
||||
* @author Emil.Zhang
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ExportExcelServiceImpl implements IExportExcelService {
|
||||
|
||||
@Override
|
||||
public void exportWithOptions(HttpServletResponse response) {
|
||||
// 创建表格数据,业务中一般通过数据库查询
|
||||
List<ExportDemoVo> excelDataList = new ArrayList<>();
|
||||
for (int i = 0; i < 3; i++) {
|
||||
// 模拟数据库中的一条数据
|
||||
ExportDemoVo everyRowData = new ExportDemoVo();
|
||||
everyRowData.setNickName("用户-" + i);
|
||||
everyRowData.setUserStatus(SystemConstants.NORMAL);
|
||||
everyRowData.setGender("1");
|
||||
everyRowData.setPhoneNumber(String.format("175%08d", i));
|
||||
everyRowData.setEmail(String.format("175%08d", i) + "@163.com");
|
||||
everyRowData.setProvinceId(i);
|
||||
everyRowData.setCityId(i);
|
||||
everyRowData.setAreaId(i);
|
||||
excelDataList.add(everyRowData);
|
||||
}
|
||||
|
||||
// 通过@ExcelIgnoreUnannotated配合@ExcelProperty合理显示需要的列
|
||||
// 并通过@DropDown注解指定下拉值,或者通过创建ExcelOptions来指定下拉框
|
||||
// 使用ExcelOptions时建议指定列index,防止出现下拉列解析不对齐
|
||||
|
||||
// 首先从数据库中查询下拉框内的可选项
|
||||
// 这里模拟查询结果
|
||||
List<DemoCityData> provinceList = getProvinceList(),
|
||||
cityList = getCityList(provinceList),
|
||||
areaList = getAreaList(cityList);
|
||||
int provinceIndex = 5, cityIndex = 6, areaIndex = 7;
|
||||
|
||||
DropDownOptions provinceToCity = DropDownOptions.buildLinkedOptions(
|
||||
provinceList,
|
||||
provinceIndex,
|
||||
cityList,
|
||||
cityIndex,
|
||||
DemoCityData::getId,
|
||||
DemoCityData::getPid,
|
||||
everyOptions -> DropDownOptions.createOptionValue(
|
||||
everyOptions.getName(),
|
||||
everyOptions.getId()
|
||||
)
|
||||
);
|
||||
|
||||
DropDownOptions cityToArea = DropDownOptions.buildLinkedOptions(
|
||||
cityList,
|
||||
cityIndex,
|
||||
areaList,
|
||||
areaIndex,
|
||||
DemoCityData::getId,
|
||||
DemoCityData::getPid,
|
||||
everyOptions -> DropDownOptions.createOptionValue(
|
||||
everyOptions.getName(),
|
||||
everyOptions.getId()
|
||||
)
|
||||
);
|
||||
|
||||
// 把所有的下拉框存储
|
||||
List<DropDownOptions> options = new ArrayList<>();
|
||||
options.add(provinceToCity);
|
||||
options.add(cityToArea);
|
||||
|
||||
// 到此为止所有的下拉框可选项已全部配置完毕
|
||||
|
||||
// 接下来需要将Excel中的展示数据转换为对应的下拉选
|
||||
List<ExportDemoVo> outList = StreamUtils.toList(excelDataList, everyRowData -> {
|
||||
// 只需要处理没有使用@ExcelDictFormat注解的下拉框
|
||||
// 一般来说,可以直接在数据库查询即查询出省市县信息,这里通过模拟操作赋值
|
||||
everyRowData.setProvince(buildOptions(provinceList, everyRowData.getProvinceId()));
|
||||
everyRowData.setCity(buildOptions(cityList, everyRowData.getCityId()));
|
||||
everyRowData.setArea(buildOptions(areaList, everyRowData.getAreaId()));
|
||||
return everyRowData;
|
||||
});
|
||||
|
||||
ExcelUtil.exportExcel(outList, "下拉框示例", ExportDemoVo.class, response, options);
|
||||
}
|
||||
|
||||
private String buildOptions(List<DemoCityData> cityDataList, Integer id) {
|
||||
Map<Integer, List<DemoCityData>> groupByIdMap =
|
||||
cityDataList.stream().collect(Collectors.groupingBy(DemoCityData::getId));
|
||||
if (groupByIdMap.containsKey(id)) {
|
||||
DemoCityData demoCityData = groupByIdMap.get(id).get(0);
|
||||
return DropDownOptions.createOptionValue(demoCityData.getName(), demoCityData.getId());
|
||||
} else {
|
||||
return StrUtil.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟查询数据库操作
|
||||
*
|
||||
* @return /
|
||||
*/
|
||||
private List<DemoCityData> getProvinceList() {
|
||||
List<DemoCityData> provinceList = new ArrayList<>();
|
||||
|
||||
// 实际业务中一般采用数据库读取的形式,这里直接拼接创建
|
||||
provinceList.add(new DemoCityData(0, null, "P100000"));
|
||||
provinceList.add(new DemoCityData(1, null, "P200000"));
|
||||
provinceList.add(new DemoCityData(2, null, "P300000"));
|
||||
|
||||
return provinceList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟查找数据库操作,需要连带查询出省的数据
|
||||
*
|
||||
* @param provinceList 模拟的父省数据
|
||||
* @return /
|
||||
*/
|
||||
private List<DemoCityData> getCityList(List<DemoCityData> provinceList) {
|
||||
List<DemoCityData> cityList = new ArrayList<>();
|
||||
|
||||
// 实际业务中一般采用数据库读取的形式,这里直接拼接创建
|
||||
cityList.add(new DemoCityData(0, 0, "C110000"));
|
||||
cityList.add(new DemoCityData(1, 0, "C120000"));
|
||||
cityList.add(new DemoCityData(2, 1, "C210000"));
|
||||
cityList.add(new DemoCityData(3, 1, "C220000"));
|
||||
cityList.add(new DemoCityData(4, 1, "C230000"));
|
||||
|
||||
selectParentData(provinceList, cityList);
|
||||
|
||||
return cityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟查找数据库操作,需要连带查询出市的数据
|
||||
*
|
||||
* @param cityList 模拟的父市数据
|
||||
* @return /
|
||||
*/
|
||||
private List<DemoCityData> getAreaList(List<DemoCityData> cityList) {
|
||||
List<DemoCityData> areaList = new ArrayList<>();
|
||||
|
||||
int minCount = 500;
|
||||
int maxCount = 10000;
|
||||
|
||||
// 实际业务中一般采用数据库读取的形式,这里直接拼接创建
|
||||
for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) {
|
||||
areaList.add(new DemoCityData(areaList.size(), 0, String.format("A11%04d", i)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) {
|
||||
areaList.add(new DemoCityData(areaList.size(), 1, String.format("A12%04d", i)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) {
|
||||
areaList.add(new DemoCityData(areaList.size(), 2, String.format("A21%04d", i)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) {
|
||||
areaList.add(new DemoCityData(areaList.size(), 3, String.format("A22%04d", i)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) {
|
||||
areaList.add(new DemoCityData(areaList.size(), 4, String.format("A23%04d", i)));
|
||||
}
|
||||
|
||||
selectParentData(cityList, areaList);
|
||||
|
||||
return areaList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟数据库的查询父数据操作
|
||||
*
|
||||
* @param parentList /
|
||||
* @param sonList /
|
||||
*/
|
||||
private void selectParentData(List<DemoCityData> parentList, List<DemoCityData> sonList) {
|
||||
Map<Integer, List<DemoCityData>> parentGroupByIdMap =
|
||||
parentList.stream().collect(Collectors.groupingBy(DemoCityData::getId));
|
||||
|
||||
sonList.forEach(everySon -> {
|
||||
if (parentGroupByIdMap.containsKey(everySon.getPid())) {
|
||||
everySon.setPData(parentGroupByIdMap.get(everySon.getPid()).get(0));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟的数据库省市县
|
||||
*/
|
||||
@Data
|
||||
private static class DemoCityData {
|
||||
/**
|
||||
* 数据库id字段
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 数据库pid字段
|
||||
*/
|
||||
private Integer pid;
|
||||
/**
|
||||
* 数据库name字段
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* MyBatisPlus连带查询父数据
|
||||
*/
|
||||
private DemoCityData pData;
|
||||
|
||||
public DemoCityData(Integer id, Integer pid, String name) {
|
||||
this.id = id;
|
||||
this.pid = pid;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.fuyuanshen.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.fuyuanshen.common.core.exception.ServiceException;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.demo.domain.TestDemo;
|
||||
import com.fuyuanshen.demo.domain.bo.TestDemoBo;
|
||||
import com.fuyuanshen.demo.domain.vo.TestDemoVo;
|
||||
import com.fuyuanshen.demo.mapper.TestDemoMapper;
|
||||
import com.fuyuanshen.demo.service.ITestDemoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 测试单表Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2021-07-26
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TestDemoServiceImpl implements ITestDemoService {
|
||||
|
||||
private final TestDemoMapper baseMapper;
|
||||
|
||||
@Override
|
||||
public TestDemoVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<TestDemoVo> queryPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||
Page<TestDemoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义分页查询
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<TestDemoVo> customPageList(TestDemoBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<TestDemo> lqw = buildQueryWrapper(bo);
|
||||
Page<TestDemoVo> result = baseMapper.customPageList(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TestDemoVo> queryList(TestDemoBo bo) {
|
||||
return baseMapper.selectVoList(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue());
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
lqw.orderByAsc(TestDemo::getId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByBo(TestDemoBo bo) {
|
||||
TestDemo add = MapstructUtils.convert(bo, TestDemo.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(TestDemoBo bo) {
|
||||
TestDemo update = MapstructUtils.convert(bo, TestDemo.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(TestDemo entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
// 做一些业务上的校验,判断是否需要校验
|
||||
List<TestDemo> list = baseMapper.selectByIds(ids);
|
||||
if (list.size() != ids.size()) {
|
||||
throw new ServiceException("您没有删除权限!");
|
||||
}
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean saveBatch(List<TestDemo> list) {
|
||||
return baseMapper.insertBatch(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package com.fuyuanshen.demo.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.core.utils.StringUtils;
|
||||
import com.fuyuanshen.demo.domain.TestTree;
|
||||
import com.fuyuanshen.demo.domain.bo.TestTreeBo;
|
||||
import com.fuyuanshen.demo.domain.vo.TestTreeVo;
|
||||
import com.fuyuanshen.demo.mapper.TestTreeMapper;
|
||||
import com.fuyuanshen.demo.service.ITestTreeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 测试树表Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2021-07-26
|
||||
*/
|
||||
// @DS("slave") // 切换从库查询
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class TestTreeServiceImpl implements ITestTreeService {
|
||||
|
||||
private final TestTreeMapper baseMapper;
|
||||
|
||||
@Override
|
||||
public TestTreeVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
// @DS("slave") // 切换从库查询
|
||||
@Override
|
||||
public List<TestTreeVo> queryList(TestTreeBo bo) {
|
||||
LambdaQueryWrapper<TestTree> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName());
|
||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
||||
TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
||||
lqw.orderByAsc(TestTree::getId);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertByBo(TestTreeBo bo) {
|
||||
TestTree add = MapstructUtils.convert(bo, TestTree.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateByBo(TestTreeBo bo) {
|
||||
TestTree update = MapstructUtils.convert(bo, TestTree.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(TestTree entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
package com.fuyuanshen.demo.service.impl;
|
@ -0,0 +1 @@
|
||||
package com.fuyuanshen.demo.service;
|
Reference in New Issue
Block a user