@@ -44,7 +44,6 @@ mybatis-plus:
|
||||
banner: false
|
||||
db-config:
|
||||
id-type: auto
|
||||
field-strategy: NOT_EMPTY
|
||||
|
||||
# 密码加解密密钥
|
||||
password:
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.hccake.ballcat.admin.modules.log.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hccake.ballcat.admin.modules.log.model.entity.AdminOperationLog;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.converter.OperationLogConverter;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import com.hccake.ballcat.admin.modules.log.mapper.AdminOperationLogMapper;
|
||||
import com.hccake.ballcat.admin.modules.log.model.entity.AdminOperationLog;
|
||||
import com.hccake.ballcat.admin.modules.log.service.OperationLogAdminService;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.converter.OperationLogConverter;
|
||||
import com.hccake.ballcat.commom.log.operation.model.OperationLogDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -26,6 +27,6 @@ public class OperationLogAdminServiceImpl extends ServiceImpl<AdminOperationLogM
|
||||
@Override
|
||||
public boolean saveLog(OperationLogDTO operationLogDTO) {
|
||||
AdminOperationLog adminOperationLog = OperationLogConverter.INSTANCE.dtoToPo(operationLogDTO);
|
||||
return retBool(baseMapper.insert(adminOperationLog));
|
||||
return SqlHelper.retBool(baseMapper.insert(adminOperationLog));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.constant.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2019-05-16
|
||||
* <p>
|
||||
* 字典类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DictTypeEnum {
|
||||
/**
|
||||
* 字典类型-系统内置(不可修改)
|
||||
*/
|
||||
SYSTEM(1, "系统内置"),
|
||||
|
||||
/**
|
||||
* 字典类型-业务类型
|
||||
*/
|
||||
BIZ(0, "业务类");
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.your.packages.admin.modules;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
* @version 1.0
|
||||
* @date 2020/3/25 23:45
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/public/test")
|
||||
public class CacheTestController {
|
||||
|
||||
|
||||
@GetMapping("1")
|
||||
// @Cached(key = "testKey1")
|
||||
public String test1(){
|
||||
return "ceshi1";
|
||||
}
|
||||
|
||||
@GetMapping("2")
|
||||
//@CachePut(key = "testKey1")
|
||||
public String test2(){
|
||||
return "ceshi2";
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("3")
|
||||
// @CacheDel(key = "testKey1")
|
||||
public void test3(){
|
||||
System.out.println("test3");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.hccake.ballcat.admin.modules.sys.manager.SysDictManager;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDict;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDictItem;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.qo.SysDictQO;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.vo.DictDataAndHashVO;
|
||||
import com.hccake.ballcat.commom.log.operation.annotation.OperationLogging;
|
||||
import com.hccake.ballcat.common.core.result.BaseResultCode;
|
||||
import com.hccake.ballcat.common.core.result.R;
|
||||
@@ -15,6 +16,9 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
@@ -29,17 +33,33 @@ import org.springframework.web.bind.annotation.*;
|
||||
public class SysDictController {
|
||||
private final SysDictManager sysDictManager;
|
||||
|
||||
|
||||
/**
|
||||
* 通过字典标识查找对应字典项
|
||||
*
|
||||
* @param dictCode 字典标识
|
||||
* @return 同类型字典
|
||||
*/
|
||||
@GetMapping("/select/{dictCode}")
|
||||
public R getDictByType(@PathVariable String dictCode) {
|
||||
return R.ok(sysDictManager.querySelectDataByDictCode(dictCode));
|
||||
@GetMapping("/data-hash/{dictCode}")
|
||||
public R<DictDataAndHashVO> getDictDataAndHash(@PathVariable String dictCode) {
|
||||
return R.ok(sysDictManager.queryDictDataAndHashVO(dictCode));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过字典标识查找对应字典项
|
||||
*
|
||||
* @param dictHashCode 字典标识
|
||||
* @return 同类型字典
|
||||
*/
|
||||
@PostMapping("/invalid-hash")
|
||||
public R<List<String>> invalidDictHash(@RequestBody Map<String, String> dictHashCode) {
|
||||
return R.ok(sysDictManager.invalidDictHash(dictHashCode));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.manager;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hccake.ballcat.admin.modules.sys.constant.enums.DictTypeEnum;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.converter.SysDictConverter;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDict;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDictItem;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.qo.SysDictQO;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.vo.DictDataAndHashVO;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.vo.DictItemVO;
|
||||
import com.hccake.ballcat.admin.modules.sys.service.SysDictItemService;
|
||||
import com.hccake.ballcat.admin.modules.sys.service.SysDictService;
|
||||
import com.hccake.ballcat.common.core.constant.enums.BooleanEm;
|
||||
import com.hccake.ballcat.common.core.exception.BusinessException;
|
||||
import com.hccake.ballcat.common.core.result.BaseResultCode;
|
||||
import com.hccake.ballcat.common.core.vo.SelectData;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
@@ -29,19 +33,12 @@ public class SysDictManager {
|
||||
private final SysDictService sysDictService;
|
||||
private final SysDictItemService sysDictItemService;
|
||||
|
||||
/**
|
||||
* 字典Select数据
|
||||
* @param dictCode 字典标识
|
||||
* @return 字典项集合组成的SelectData
|
||||
*/
|
||||
public List<SelectData> querySelectDataByDictCode(String dictCode) {
|
||||
return sysDictItemService.querySelectDataByDictCode(dictCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典表分页
|
||||
* @param page 分页参数
|
||||
* @param sysDictQO 查询参数
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param sysDictQO 查询参数
|
||||
* @return 字典表分页数据
|
||||
*/
|
||||
public IPage<SysDict> dictPage(Page<SysDict> page, SysDictQO sysDictQO) {
|
||||
@@ -50,31 +47,37 @@ public class SysDictManager {
|
||||
|
||||
/**
|
||||
* 保存字典
|
||||
*
|
||||
* @param sysDict 字典对象
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
public boolean dictSave(SysDict sysDict) {
|
||||
sysDict.setHashCode(IdUtil.fastSimpleUUID());
|
||||
sysDict.setDelFlag(BooleanEm.FALSE.getValue());
|
||||
return sysDictService.save(sysDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典
|
||||
*
|
||||
* @param sysDict 字典对象
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
public boolean updateDictById(SysDict sysDict) {
|
||||
// 查询现有数据
|
||||
SysDict oldData = sysDictService.getById(sysDict.getId());
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(oldData.getType())) {
|
||||
SysDict dict = sysDictService.getById(sysDict.getId());
|
||||
if (BooleanEm.TRUE.getValue() != dict.getEditable()) {
|
||||
throw new BusinessException(
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "系统内置字典项目不能修改"
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "该字典项目不能修改"
|
||||
);
|
||||
}
|
||||
sysDict.setHashCode(IdUtil.fastSimpleUUID());
|
||||
return sysDictService.updateById(sysDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
*
|
||||
* @param id 字典id
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
@@ -82,13 +85,13 @@ public class SysDictManager {
|
||||
public boolean removeDictById(Integer id) {
|
||||
// 查询现有数据
|
||||
SysDict dict = sysDictService.getById(id);
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(dict.getType())) {
|
||||
if (BooleanEm.TRUE.getValue() != dict.getEditable()) {
|
||||
throw new BusinessException(
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "系统内置字典项目不能删除"
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "该字典项目不能删除"
|
||||
);
|
||||
}
|
||||
// 需级联删除对应的字典项
|
||||
if(sysDictService.removeById(id)){
|
||||
if (sysDictService.removeById(id)) {
|
||||
sysDictItemService.remove(Wrappers.<SysDictItem>lambdaUpdate()
|
||||
.eq(SysDictItem::getDictCode, dict.getCode())
|
||||
);
|
||||
@@ -99,7 +102,8 @@ public class SysDictManager {
|
||||
|
||||
/**
|
||||
* 字典项分页
|
||||
* @param page 分页属性
|
||||
*
|
||||
* @param page 分页属性
|
||||
* @param dictCode 字典标识
|
||||
* @return 字典项分页数据
|
||||
*/
|
||||
@@ -109,34 +113,47 @@ public class SysDictManager {
|
||||
|
||||
/**
|
||||
* 新增字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
public boolean saveDictItem(SysDictItem sysDictItem) {
|
||||
// 更新字典项Hash值
|
||||
if (!sysDictService.updateHashCode(sysDictItem.getDictCode())) {
|
||||
return false;
|
||||
}
|
||||
sysDictItem.setDelFlag(BooleanEm.FALSE.getValue());
|
||||
return sysDictItemService.save(sysDictItem);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新字典项
|
||||
*
|
||||
* @param sysDictItem 字典项
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
public boolean updateDictItemById(SysDictItem sysDictItem) {
|
||||
// 根据ID查询字典
|
||||
SysDict dict = sysDictService.getByCode(sysDictItem.getDictCode());
|
||||
// 校验是否系统内置
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(dict.getType())) {
|
||||
// 校验是否可编辑
|
||||
if (BooleanEm.TRUE.getValue() != dict.getEditable()) {
|
||||
throw new BusinessException(
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "系统内置字典项目不能修改"
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "该字典项目不能修改"
|
||||
);
|
||||
}
|
||||
// 更新字典项Hash值
|
||||
if (!sysDictService.updateHashCode(sysDictItem.getDictCode())) {
|
||||
return false;
|
||||
}
|
||||
return sysDictItemService.updateById(sysDictItem);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除字典项
|
||||
*
|
||||
* @param id 字典项
|
||||
* @return 执行是否成功
|
||||
*/
|
||||
@@ -145,12 +162,51 @@ public class SysDictManager {
|
||||
SysDictItem dictItem = sysDictItemService.getById(id);
|
||||
SysDict dict = sysDictService.getByCode(dictItem.getDictCode());
|
||||
// 校验是否系统内置
|
||||
if (DictTypeEnum.SYSTEM.getType().equals(dict.getType())) {
|
||||
if (BooleanEm.TRUE.getValue() != dict.getEditable()) {
|
||||
throw new BusinessException(
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "系统内置字典项目不能删除"
|
||||
BaseResultCode.LOGIC_CHECK_ERROR.getCode(), "该字典项目不能删除"
|
||||
);
|
||||
}
|
||||
return sysDictItemService.removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据
|
||||
*
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
public DictDataAndHashVO queryDictDataAndHashVO(String dictCode) {
|
||||
// 查询对应hash值,以及字典项数据
|
||||
SysDict sysDict = sysDictService.getByCode(dictCode);
|
||||
if (sysDict == null) {
|
||||
return null;
|
||||
}
|
||||
List<SysDictItem> dictItems = sysDictItemService.getByDictCode(dictCode);
|
||||
// 排序并转换为VO
|
||||
List<DictItemVO> dictList = dictItems.stream()
|
||||
.sorted(Comparator.comparingInt(SysDictItem::getSort))
|
||||
.map(SysDictConverter.INSTANCE::itemPoToVo)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 组装DataVO
|
||||
DictDataAndHashVO dictDataAndHashVO = new DictDataAndHashVO();
|
||||
dictDataAndHashVO.setHashCode(sysDict.getHashCode());
|
||||
dictDataAndHashVO.setDictList(dictList);
|
||||
return dictDataAndHashVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回失效的Hash
|
||||
*
|
||||
* @param dictHashCode 校验的hashCodeMap
|
||||
* @return
|
||||
*/
|
||||
public List<String> invalidDictHash(Map<String, String> dictHashCode) {
|
||||
List<SysDict> byCode = sysDictService.getByCode(dictHashCode.keySet().toArray(new String[]{}));
|
||||
// 过滤相等Hash值的字典项,并返回需要修改的字典项的Code
|
||||
return byCode.stream()
|
||||
.filter(x -> !dictHashCode.get(x.getCode()).equals(x.getHashCode()))
|
||||
.map(SysDict::getCode).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.converter;
|
||||
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDictItem;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.vo.DictItemVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
* @version 1.0
|
||||
* @date 2020/4/9 16:32
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysDictConverter {
|
||||
SysDictConverter INSTANCE = Mappers.getMapper(SysDictConverter.class);
|
||||
|
||||
/**
|
||||
* 字典项实体转VO
|
||||
* @param sysDictItem
|
||||
* @return
|
||||
*/
|
||||
DictItemVO itemPoToVo(SysDictItem sysDictItem);
|
||||
|
||||
}
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -40,20 +37,26 @@ public class SysDict extends Model<SysDict> {
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
private String title;
|
||||
/**
|
||||
* Hash值
|
||||
*/
|
||||
@ApiModelProperty(value = "Hash值")
|
||||
private String hashCode;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
/**
|
||||
* 字典类型
|
||||
* 可编辑的
|
||||
*/
|
||||
@ApiModelProperty(value = "1:系统 2:业务")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "1:是 0:否")
|
||||
private Integer editable;
|
||||
/**
|
||||
* 逻辑删除标识
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "逻辑删除标识")
|
||||
private Integer delFlag;
|
||||
/**
|
||||
@@ -65,7 +68,7 @@ public class SysDict extends Model<SysDict> {
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -42,10 +39,10 @@ public class SysDictItem extends Model<SysDictItem> {
|
||||
@ApiModelProperty(value = "数据值")
|
||||
private String value;
|
||||
/**
|
||||
* 标签
|
||||
* 文本值
|
||||
*/
|
||||
@ApiModelProperty(value = "标签")
|
||||
private String label;
|
||||
@ApiModelProperty(value = "文本值")
|
||||
private String name;
|
||||
/**
|
||||
* 排序(升序)
|
||||
*/
|
||||
@@ -59,6 +56,7 @@ public class SysDictItem extends Model<SysDictItem> {
|
||||
/**
|
||||
* 逻辑删除标志
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "逻辑删除标志")
|
||||
private Integer delFlag;
|
||||
/**
|
||||
@@ -70,7 +68,7 @@ public class SysDictItem extends Model<SysDictItem> {
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -101,6 +98,7 @@ public class SysPermission extends Model<SysPermission> {
|
||||
/**
|
||||
* 逻辑删除标记(0--正常 1--删除)
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value="逻辑删除标记(0--正常 1--删除)")
|
||||
private Integer delFlag;
|
||||
/**
|
||||
@@ -113,7 +111,7 @@ public class SysPermission extends Model<SysPermission> {
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class SysRole extends Model<SysRole> {
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty(value = "修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ private static final long serialVersionUID = 1L;
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value="更新时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@ApiModelProperty(value="1:系统用户, 2:客户用户")
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
* @version 1.0
|
||||
* @date 2020/4/9 15:48
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "字典数据VO")
|
||||
public class DictDataAndHashVO {
|
||||
/**
|
||||
* 字典Hash值
|
||||
*/
|
||||
@ApiModelProperty(value="字典Hash值")
|
||||
private String hashCode;
|
||||
|
||||
/**
|
||||
* 字典项列表
|
||||
*/
|
||||
@ApiModelProperty(value="字典数据")
|
||||
private List<DictItemVO> dictList;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
*
|
||||
* @author hccake
|
||||
* @date 2020-03-26 18:40:20
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "字典项VO")
|
||||
public class DictItemVO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 数据值
|
||||
*/
|
||||
@ApiModelProperty(value = "数据值")
|
||||
private String value;
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
@ApiModelProperty(value = "文本值")
|
||||
private String name;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.model.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,6 +12,7 @@ import java.time.LocalDateTime;
|
||||
* @date 2019/10/15 14:19
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "权限VO")
|
||||
public class PermissionVO {
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.hccake.ballcat.admin.modules.sys.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDictItem;
|
||||
import com.hccake.ballcat.common.core.vo.SelectData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -23,10 +22,11 @@ public interface SysDictItemService extends IService<SysDictItem> {
|
||||
*/
|
||||
IPage<SysDictItem> page(IPage<SysDictItem> page, String dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典标识查询对应字典选择项
|
||||
* @param dictCode 字典标识
|
||||
* @return 对应字典项的SelectData
|
||||
* 根据Code查询对应字典项数据
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
List<SelectData> querySelectDataByDictCode(String dictCode);
|
||||
List<SysDictItem> getByDictCode(String dictCode);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDict;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.qo.SysDictQO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
*
|
||||
@@ -27,4 +29,20 @@ public interface SysDictService extends IService<SysDict> {
|
||||
* @return 字典数据
|
||||
*/
|
||||
SysDict getByCode(String dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典标识查询
|
||||
* @param dictCode 字典标识
|
||||
* @return 字典数据
|
||||
*/
|
||||
List<SysDict> getByCode(String[] dictCode);
|
||||
|
||||
|
||||
/**
|
||||
* 更新字典HashCode
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
boolean updateHashCode(String dictCode);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.hccake.ballcat.admin.modules.sys.mapper.SysDictItemMapper;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDictItem;
|
||||
import com.hccake.ballcat.admin.modules.sys.service.SysDictItemService;
|
||||
import com.hccake.ballcat.common.core.vo.SelectData;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -34,15 +33,17 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
|
||||
return baseMapper.selectPage(page, wrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据字典标识查询对应字典选择项
|
||||
* 根据Code查询对应字典项数据
|
||||
*
|
||||
* @param dictCode 字典标识
|
||||
* @return 对应字典项的SelectData
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SelectData> querySelectDataByDictCode(String dictCode) {
|
||||
return baseMapper.querySelectDataByDictCode(dictCode);
|
||||
public List<SysDictItem> getByDictCode(String dictCode) {
|
||||
return baseMapper.selectList(Wrappers.<SysDictItem>lambdaQuery()
|
||||
.eq(SysDictItem::getDictCode, dictCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
package com.hccake.ballcat.admin.modules.sys.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.entity.SysDict;
|
||||
import com.hccake.ballcat.admin.modules.sys.model.qo.SysDictQO;
|
||||
import com.hccake.ballcat.admin.modules.sys.mapper.SysDictMapper;
|
||||
import com.hccake.ballcat.admin.modules.sys.service.SysDictService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 字典表
|
||||
*
|
||||
@@ -21,11 +26,12 @@ import org.springframework.stereotype.Service;
|
||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService {
|
||||
|
||||
/**
|
||||
* 根据QueryObeject查询分页数据
|
||||
* @param page 分页参数
|
||||
* @param qo 查询参数对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
* 根据QueryObeject查询分页数据
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param qo 查询参数对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysDict> page(IPage<SysDict> page, SysDictQO qo) {
|
||||
LambdaQueryWrapper<SysDict> wrapper = Wrappers.<SysDict>lambdaQuery()
|
||||
@@ -46,4 +52,34 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典标识查询
|
||||
*
|
||||
* @param dictCode 字典标识
|
||||
* @return 字典数据
|
||||
*/
|
||||
@Override
|
||||
public List<SysDict> getByCode(String[] dictCode) {
|
||||
if (dictCode == null || dictCode.length == 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return baseMapper.selectList(
|
||||
Wrappers.<SysDict>lambdaQuery().in(SysDict::getCode, dictCode)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新字典HashCode
|
||||
*
|
||||
* @param dictCode
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean updateHashCode(String dictCode) {
|
||||
int flag = baseMapper.update(null, Wrappers.<SysDict>lambdaUpdate()
|
||||
.set(SysDict::getHashCode, IdUtil.fastSimpleUUID())
|
||||
.eq(SysDict::getCode, dictCode));
|
||||
return SqlHelper.retBool(flag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
String password = PasswordUtil.decodeAesAndEncodeBCrypt(sysUserDto.getPass(), secretKey);
|
||||
sysUser.setPassword(password);
|
||||
|
||||
return retBool(baseMapper.insert(sysUser));
|
||||
return SqlHelper.retBool(baseMapper.insert(sysUser));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,7 +149,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
@Override
|
||||
public boolean updateSysUser(SysUserDTO sysUserDTO) {
|
||||
SysUser entity = SysUserConverter.INSTANCE.dtoToPo(sysUserDTO);
|
||||
return retBool(baseMapper.updateById(entity));
|
||||
return SqlHelper.retBool(baseMapper.updateById(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,7 +198,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
.set(SysUser::getPassword, password)
|
||||
);
|
||||
|
||||
return retBool(res);
|
||||
return SqlHelper.retBool(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<?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.hccake.ballcat.admin.modules.sys.mapper.SysDictItemMapper">
|
||||
|
||||
<select id="querySelectDataByDictCode" resultType="com.hccake.ballcat.common.core.vo.SelectData">
|
||||
select
|
||||
label as name, value
|
||||
from
|
||||
sys_dict_item
|
||||
where
|
||||
del_flag = 0
|
||||
and dict_code = #{dictCode}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -45,6 +45,7 @@ public class GenUtils {
|
||||
|
||||
|
||||
private final String QO_JAVA_VM = "QO.java.vm";
|
||||
private final String VO_JAVA_VM = "VO.java.vm";
|
||||
private final String ENTITY_JAVA_VM = "Entity.java.vm";
|
||||
private final String MAPPER_JAVA_VM = "Mapper.java.vm";
|
||||
private final String SERVICE_JAVA_VM = "Service.java.vm";
|
||||
@@ -61,6 +62,7 @@ public class GenUtils {
|
||||
private List<String> getTemplates() {
|
||||
List<String> templates = new ArrayList<>();
|
||||
templates.add("template/QO.java.vm");
|
||||
templates.add("template/VO.java.vm");
|
||||
templates.add("template/Entity.java.vm");
|
||||
templates.add("template/Mapper.java.vm");
|
||||
templates.add("template/Mapper.xml.vm");
|
||||
@@ -148,6 +150,7 @@ public class GenUtils {
|
||||
map.put("pk", tableEntity.getPk());
|
||||
map.put("className", tableEntity.getCaseClassName());
|
||||
map.put("classname", tableEntity.getLowerClassName());
|
||||
map.put("tableAlias", prodAlias(tableEntity.getCaseClassName()));
|
||||
map.put("pathName", tableEntity.getLowerClassName().toLowerCase());
|
||||
map.put("columns", tableEntity.getColumns());
|
||||
map.put("hasBigDecimal", hasBigDecimal);
|
||||
@@ -157,7 +160,6 @@ public class GenUtils {
|
||||
map.put("moduleName", genConfig.getModuleName());
|
||||
map.put("package", genConfig.getPackageName());
|
||||
|
||||
|
||||
VelocityContext context = new VelocityContext(map);
|
||||
|
||||
//获取模板列表
|
||||
@@ -178,6 +180,21 @@ public class GenUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类名生成表别名
|
||||
* @param className 类名
|
||||
* @return 表别名
|
||||
*/
|
||||
private String prodAlias(String className) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (char c : className.toCharArray()) {
|
||||
if(c >= 'A' && c <= 'Z'){
|
||||
sb.append(Character.toLowerCase(c));
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列名转换成Java属性名
|
||||
@@ -205,6 +222,10 @@ public class GenUtils {
|
||||
packagePath += packageName.replace(".", File.separator) + File.separator + moduleName + File.separator;
|
||||
}
|
||||
|
||||
if (template.contains(VO_JAVA_VM)) {
|
||||
return packagePath + "model" + File.separator + "vo" + File.separator + className + "VO.java";
|
||||
}
|
||||
|
||||
if (template.contains(QO_JAVA_VM)) {
|
||||
return packagePath + "model" + File.separator + "qo" + File.separator + className + "QO.java";
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.hccake.ballcat.common.core.result.R;
|
||||
import com.hccake.ballcat.commom.log.operation.annotation.OperationLogging;
|
||||
import ${package}.${moduleName}.model.entity.${className};
|
||||
import ${package}.${moduleName}.model.qo.${className}QO;
|
||||
import ${package}.${moduleName}.model.vo.${className}VO;
|
||||
import ${package}.${moduleName}.service.${className}Service;
|
||||
import com.hccake.ballcat.common.core.result.BaseResultCode;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -38,9 +39,9 @@ public class ${className}Controller {
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@per.hasPermission('${moduleName}:${pathName}:read')" )
|
||||
public R<IPage<${className}>> get${className}Page(
|
||||
Page<${className}> page, ${className}QO ${classname}QO) {
|
||||
return R.ok(${classname}Service.page(page, ${classname}QO));
|
||||
public R<IPage<${className}VO>> get${className}Page(
|
||||
Page<?> page, ${className}QO ${classname}QO) {
|
||||
return R.ok(${classname}Service.selectPageVo(page, ${classname}QO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ private static final long serialVersionUID = 1L;
|
||||
#elseif($column.columnName == 'create_time')
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
#elseif($column.columnName == 'update_time')
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
#end
|
||||
@ApiModelProperty(value="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
private $column.attrType $column.lowerAttrName;
|
||||
|
||||
@@ -42,14 +42,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FormMixin } from '@/mixins'
|
||||
import AFormItem from 'ant-design-vue/es/form/FormItem'
|
||||
import { FormPageMixin } from '@/mixins'
|
||||
import { addObj, putObj } from '@/api/${moduleName}/${pathName}'
|
||||
|
||||
export default {
|
||||
name: '${className}FormPage',
|
||||
components: {AFormItem },
|
||||
mixins: [FormMixin],
|
||||
mixins: [FormPageMixin],
|
||||
data () {
|
||||
return {
|
||||
addObj: addObj,
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package ${package}.${moduleName}.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import ${package}.${moduleName}.model.entity.${className};
|
||||
import ${package}.${moduleName}.model.vo.${className}VO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
@@ -11,4 +16,11 @@ import ${package}.${moduleName}.model.entity.${className};
|
||||
*/
|
||||
public interface ${className}Mapper extends BaseMapper<${className}> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @return VO分页数据
|
||||
*/
|
||||
IPage<${className}VO> selectPageVo(IPage<?> page, @Param(Constants.WRAPPER) Wrapper<${className}> wrapper);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
<?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="${package}.${moduleName}.mapper.${className}Mapper">
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
#foreach($column in $columns)
|
||||
${column.columnName}#if( $foreach.hasNext ),#end
|
||||
#end
|
||||
</sql>
|
||||
|
||||
<sql id="Base_Alias_Column_List" >
|
||||
#foreach($column in $columns)
|
||||
${tableAlias}.${column.columnName}#if( $foreach.hasNext ),#end
|
||||
#end
|
||||
</sql>
|
||||
|
||||
<resultMap id="${classname}Map" type="${package}.${moduleName}.model.entity.${className}">
|
||||
#foreach($column in $columns)
|
||||
#if($column.lowerAttrName==$pk.lowerAttrName)
|
||||
|
||||
@@ -71,11 +71,11 @@
|
||||
<script>
|
||||
import { getPage, delObj } from '@/api/${moduleName}/${pathName}'
|
||||
import FormPage from './${className}Form'
|
||||
import { PageMixin } from '@/mixins'
|
||||
import { TablePageMixin } from '@/mixins'
|
||||
|
||||
export default {
|
||||
name: '${className}Page',
|
||||
mixins: [PageMixin],
|
||||
mixins: [TablePageMixin],
|
||||
components: { FormPage },
|
||||
data () {
|
||||
return {
|
||||
@@ -85,10 +85,17 @@ export default {
|
||||
columns: [
|
||||
#foreach ($column in $columns)
|
||||
#if($column.columnName != 'create_time' && $column.columnName != 'update_time')
|
||||
{
|
||||
title: '$column.comments',
|
||||
dataIndex: '$column.lowerAttrName',
|
||||
},
|
||||
#if($column.columnName == 'id')
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: '$column.lowerAttrName',
|
||||
},
|
||||
#else
|
||||
{
|
||||
title: '$column.comments',
|
||||
dataIndex: '$column.lowerAttrName',
|
||||
},
|
||||
#end
|
||||
#end
|
||||
#end
|
||||
{
|
||||
|
||||
@@ -3,12 +3,9 @@ package ${package}.${moduleName}.model.qo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
#if(${hasBigDecimal})
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* ${comments} 查询对象
|
||||
|
||||
@@ -3,6 +3,7 @@ package ${package}.${moduleName}.service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import ${package}.${moduleName}.model.entity.${className};
|
||||
import ${package}.${moduleName}.model.vo.${className}VO;
|
||||
import ${package}.${moduleName}.model.qo.${className}QO;
|
||||
|
||||
/**
|
||||
@@ -19,6 +20,6 @@ public interface ${className}Service extends IService<${className}> {
|
||||
* @param qo 查询参数对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
IPage<${className}> page(IPage<${className}> page, ${className}QO qo);
|
||||
IPage<${className}VO> selectPageVo(IPage<?> page, ${className}QO qo);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package ${package}.${moduleName}.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ${package}.${moduleName}.model.entity.${className};
|
||||
import ${package}.${moduleName}.model.vo.${className}VO;
|
||||
import ${package}.${moduleName}.model.qo.${className}QO;
|
||||
import ${package}.${moduleName}.mapper.${className}Mapper;
|
||||
import ${package}.${moduleName}.service.${className}Service;
|
||||
@@ -27,10 +28,10 @@ public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${c
|
||||
* @return 分页数据
|
||||
*/
|
||||
@Override
|
||||
public IPage<${className}> page(IPage<${className}> page, ${className}QO qo) {
|
||||
LambdaQueryWrapper<${className}> wrapper = Wrappers.<${className}>lambdaQuery()
|
||||
.eq(ObjectUtil.isNotNull(qo.get${pk.caseAttrName}()), ${className}::get${pk.caseAttrName}, qo.get${pk.caseAttrName}());
|
||||
return baseMapper.selectPage(page, wrapper);
|
||||
public IPage<${className}VO> selectPageVo(IPage<?> page, ${className}QO qo) {
|
||||
QueryWrapper<${className}> wrapper = Wrappers.<${className}>query()
|
||||
.eq(ObjectUtil.isNotNull(qo.get${pk.caseAttrName}()), "${tableAlias}.{pk.caseAttrName}", qo.get${pk.caseAttrName}());
|
||||
return baseMapper.selectPageVo(page, wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
32
ballcat-codegen/src/main/resources/template/VO.java.vm
Normal file
32
ballcat-codegen/src/main/resources/template/VO.java.vm
Normal file
@@ -0,0 +1,32 @@
|
||||
package ${package}.${moduleName}.model.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
#if(${hasBigDecimal})
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* ${comments}
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "${comments}")
|
||||
public class ${className}VO {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
/**
|
||||
* $column.comments
|
||||
*/
|
||||
@ApiModelProperty(value="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
private $column.attrType $column.lowerAttrName;
|
||||
#end
|
||||
}
|
||||
@@ -35,6 +35,9 @@ public class JacksonConfig {
|
||||
// NULL 值转 ""
|
||||
objectMapper.getSerializerProvider().setNullValueSerializer(new NullSerializer());
|
||||
|
||||
// 所有数字转字符串输出
|
||||
// objectMapper.configure(JsonWriteFeature.WRITE_NUMBERS_AS_STRINGS.mappedFeature(), true);
|
||||
|
||||
//注册xss解析器
|
||||
// SimpleModule xssModule = new SimpleModule("XssStringJsonSerializer", PackageVersion.VERSION);
|
||||
// xssModule.addSerializer(new XssStringJsonSerializer());
|
||||
|
||||
@@ -18,11 +18,11 @@ public class FillMetaObjectHandle implements MetaObjectHandler {
|
||||
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
this.setInsertFieldValByName("createTime", LocalDateTime.now(), metaObject);
|
||||
this.strictInsertFill(metaObject,"createTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
this.setUpdateFieldValByName("updateTime", LocalDateTime.now(), metaObject);
|
||||
this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.hccake.ballcat.common.core.constant.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Hccake
|
||||
* @version 1.0
|
||||
* @date 2020/4/6 21:52
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum BooleanEm {
|
||||
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
TRUE(1),
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
FALSE(0);
|
||||
|
||||
private int value;
|
||||
}
|
||||
@@ -65,6 +65,6 @@ public class BaseConfig extends Model<BaseConfig> {
|
||||
* 修改时间
|
||||
*/
|
||||
@ApiModelProperty(value="修改时间")
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user