mdf:用户,部门去jpa2

This commit is contained in:
zhangzhiqiang
2022-11-30 10:38:50 +08:00
parent 99d78828a1
commit 839863ade9
36 changed files with 94 additions and 235 deletions

View File

@@ -2,19 +2,10 @@ package org.nl.modules.common.base;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import javax.persistence.Column;
import java.io.Serializable; import java.io.Serializable;
import java.lang.reflect.Field; import java.util.Date;
import java.sql.Date; import java.util.Date;
import java.sql.Timestamp;
/** /**
* @author Zheng Jie * @author Zheng Jie

View File

@@ -18,8 +18,6 @@ package org.nl.modules.common.base;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;
import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.jpa.domain.support.AuditingEntityListener; import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@@ -28,7 +26,7 @@ import javax.persistence.Column;
import javax.persistence.EntityListeners; import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.util.Date;
/** /**
* 通用字段, is_del 根据需求自行添加 * 通用字段, is_del 根据需求自行添加
@@ -55,15 +53,13 @@ public class BaseEntity implements Serializable {
private Long update_optid; private Long update_optid;
@CreationTimestamp
@Column(name = "create_time", updatable = false) @Column(name = "create_time", updatable = false)
@ApiModelProperty(value = "创建时间", hidden = true) @ApiModelProperty(value = "创建时间", hidden = true)
private Timestamp create_time; private Date create_time;
@UpdateTimestamp
@Column(name = "update_time") @Column(name = "update_time")
@ApiModelProperty(value = "更新时间", hidden = true) @ApiModelProperty(value = "更新时间", hidden = true)
private Timestamp update_time; private Date update_time;
/* 分组校验 */ /* 分组校验 */
public @interface Create {} public @interface Create {}

View File

@@ -29,11 +29,11 @@ class ApiError {
private Integer status = 400; private Integer status = 400;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime timestamp; private LocalDateTime Date;
private String message; private String message;
private ApiError() { private ApiError() {
timestamp = LocalDateTime.now(); Date = LocalDateTime.now();
} }
public static ApiError error(String message){ public static ApiError error(String message){

View File

@@ -36,18 +36,18 @@ public class DateUtil {
* @param localDateTime / * @param localDateTime /
* @return / * @return /
*/ */
public static Long getTimeStamp(LocalDateTime localDateTime) { public static Long getDate(LocalDateTime localDateTime) {
return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond(); return localDateTime.atZone(ZoneId.systemDefault()).toEpochSecond();
} }
/** /**
* 时间戳转LocalDateTime * 时间戳转LocalDateTime
* *
* @param timeStamp / * @param Date /
* @return / * @return /
*/ */
public static LocalDateTime fromTimeStamp(Long timeStamp) { public static LocalDateTime fromDate(Long Date) {
return LocalDateTime.ofEpochSecond(timeStamp, 0, OffsetDateTime.now().getOffset()); return LocalDateTime.ofEpochSecond(Date, 0, OffsetDateTime.now().getOffset());
} }
/** /**

View File

@@ -47,7 +47,7 @@ import static org.nl.modules.common.utils.FileUtil.SYS_TEM_DIR;
@SuppressWarnings({"unchecked", "all"}) @SuppressWarnings({"unchecked", "all"})
public class GenUtil { public class GenUtil {
private static final String TIMESTAMP = "Timestamp"; private static final String Date = "Date";
private static final String BIGDECIMAL = "BigDecimal"; private static final String BIGDECIMAL = "BigDecimal";
@@ -218,10 +218,10 @@ public class GenUtil {
genMap.put("className", className); genMap.put("className", className);
// 保存小写开头的类名 // 保存小写开头的类名
genMap.put("changeClassName", changeClassName); genMap.put("changeClassName", changeClassName);
// 存在 Timestamp 字段 // 存在 Date 字段
genMap.put("hasTimestamp", false); genMap.put("hasDate", false);
// 查询类中存在 Timestamp 字段 // 查询类中存在 Date 字段
genMap.put("queryHasTimestamp", false); genMap.put("queryHasDate", false);
// 存在 BigDecimal 字段 // 存在 BigDecimal 字段
genMap.put("hasBigDecimal", false); genMap.put("hasBigDecimal", false);
// 查询类中存在 BigDecimal 字段 // 查询类中存在 BigDecimal 字段
@@ -266,9 +266,9 @@ public class GenUtil {
// 存储大写开头的字段名 // 存储大写开头的字段名
genMap.put("pkCapitalColName", capitalColumnName); genMap.put("pkCapitalColName", capitalColumnName);
} }
// 是否存在 Timestamp 类型的字段 // 是否存在 Date 类型的字段
if (TIMESTAMP.equals(colType)) { if (Date.equals(colType)) {
genMap.put("hasTimestamp", true); genMap.put("hasDate", true);
} }
// 是否存在 BigDecimal 类型的字段 // 是否存在 BigDecimal 类型的字段
if (BIGDECIMAL.equals(colType)) { if (BIGDECIMAL.equals(colType)) {
@@ -317,9 +317,9 @@ public class GenUtil {
listMap.put("queryType", column.getQueryType()); listMap.put("queryType", column.getQueryType());
// 是否存在查询 // 是否存在查询
genMap.put("hasQuery", true); genMap.put("hasQuery", true);
if (TIMESTAMP.equals(colType)) { if (Date.equals(colType)) {
// 查询中存储 Timestamp 类型 // 查询中存储 Date 类型
genMap.put("queryHasTimestamp", true); genMap.put("queryHasDate", true);
} }
if (BIGDECIMAL.equals(colType)) { if (BIGDECIMAL.equals(colType)) {
// 查询中存储 BigDecimal 类型 // 查询中存储 BigDecimal 类型

View File

@@ -18,11 +18,10 @@ package org.nl.modules.logging.domain;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.util.Date;
/** /**
* @author Zheng Jie * @author Zheng Jie
@@ -71,8 +70,7 @@ public class Log implements Serializable {
private byte[] exceptionDetail; private byte[] exceptionDetail;
/** 创建日期 */ /** 创建日期 */
@CreationTimestamp private Date createTime;
private Timestamp createTime;
public Log(String logType, Long time) { public Log(String logType, Long time) {
this.logType = logType; this.logType = logType;

View File

@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.util.Date;
/** /**
* @author Zheng Jie * @author Zheng Jie
@@ -43,5 +43,5 @@ public class LogErrorDTO implements Serializable {
private String address; private String address;
private Timestamp createTime; private Date createTime;
} }

View File

@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
import lombok.Data; import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -36,5 +36,5 @@ public class LogQueryCriteria {
private String logType; private String logType;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime; private List<Date> createTime;
} }

View File

@@ -18,7 +18,7 @@ package org.nl.modules.logging.service.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.util.Date;
/** /**
* @author Zheng Jie * @author Zheng Jie
@@ -37,5 +37,5 @@ public class LogSmallDTO implements Serializable {
private String browser; private String browser;
private Timestamp createTime; private Date createTime;
} }

View File

@@ -17,11 +17,10 @@ package org.nl.modules.quartz.domain;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import javax.persistence.*; import javax.persistence.*;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp; import java.util.Date;
/** /**
* @author Zheng Jie * @author Zheng Jie
@@ -62,7 +61,7 @@ public class QuartzLog implements Serializable {
@ApiModelProperty(value = "执行耗时", hidden = true) @ApiModelProperty(value = "执行耗时", hidden = true)
private Long time; private Long time;
@CreationTimestamp
@ApiModelProperty(value = "创建时间", hidden = true) @ApiModelProperty(value = "创建时间", hidden = true)
private Timestamp createTime; private Date createTime;
} }

View File

@@ -18,7 +18,7 @@ package org.nl.modules.quartz.service.dto;
import lombok.Data; import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -35,5 +35,5 @@ public class JobQueryCriteria {
private Boolean isSuccess; private Boolean isSuccess;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime; private List<Date> createTime;
} }

View File

@@ -85,13 +85,7 @@ public interface DeptService {
* @return / * @return /
*/ */
<T> T findById(Long id, Class<T> tagert); <T> T findById(Long id, Class<T> tagert);
/**
* 根据角色ID查询
*
* @param id /
* @return /
*/
Set<Dept> findByRoleId(Long id);
/** /**

View File

@@ -19,9 +19,7 @@ import lombok.Data;
import org.nl.modules.common.annotation.DataPermission; import org.nl.modules.common.annotation.DataPermission;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @author Zheng Jie * @author Zheng Jie

View File

@@ -18,7 +18,7 @@ package org.nl.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -32,7 +32,7 @@ public class MenuQueryCriteria {
private String blurry; private String blurry;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime; private List<Date> createTime;
@Query(type = Query.Type.IS_NULL, propName = "pid") @Query(type = Query.Type.IS_NULL, propName = "pid")
private Boolean pidIsNull; private Boolean pidIsNull;

View File

@@ -18,7 +18,7 @@ package org.nl.modules.system.service.dto;
import lombok.Data; import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp; import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@@ -32,5 +32,5 @@ public class RoleQueryCriteria {
private String blurry; private String blurry;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime; private List<Date> createTime;
} }

View File

@@ -19,10 +19,8 @@ import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.io.Serializable; import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**

View File

@@ -82,15 +82,17 @@ public class DataServiceImpl implements DataService {
* @param role 角色 * @param role 角色
* @return 数据权限ID * @return 数据权限ID
*/ */
@Deprecated
public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){ public Set<Long> getCustomize(Set<Long> deptIds, RoleSmallDto role){
Set<Dept> depts = deptService.findByRoleId(role.getId()); //角色跟部门不挂钩
for (Dept dept : depts) { // Set<Dept> depts = deptService.findByRoleId(role.getId());
deptIds.add(dept.getDept_id()); // for (Dept dept : depts) {
List<Dept> deptChildren = deptService.findByPid(dept.getPid()); // deptIds.add(dept.getDept_id());
if (deptChildren != null && deptChildren.size() != 0) { // List<Dept> deptChildren = deptService.findByPid(dept.getPid());
deptIds.addAll(deptService.getDeptChildren(deptChildren)); // if (deptChildren != null && deptChildren.size() != 0) {
} // deptIds.addAll(deptService.getDeptChildren(deptChildren));
} // }
return deptIds; // }
return null;
} }
} }

View File

@@ -17,7 +17,6 @@ package org.nl.modules.system.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Db; import cn.hutool.db.Db;
import cn.hutool.db.Entity; import cn.hutool.db.Entity;
@@ -25,22 +24,14 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.common.utils.CacheKey; import org.nl.modules.common.utils.CacheKey;
import org.nl.modules.common.utils.QueryHelp;
import org.nl.modules.common.utils.RedisUtils; import org.nl.modules.common.utils.RedisUtils;
import org.nl.modules.common.utils.ValidationUtil;
import org.nl.modules.system.domain.Dept; import org.nl.modules.system.domain.Dept;
import org.nl.modules.system.domain.User;
import org.nl.modules.system.repository.DeptRepository;
import org.nl.modules.system.repository.RoleRepository;
import org.nl.modules.system.repository.UserRepository;
import org.nl.modules.system.service.DeptService; import org.nl.modules.system.service.DeptService;
import org.nl.modules.system.service.dto.DeptDto; import org.nl.modules.system.service.dto.DeptDto;
import org.nl.modules.system.service.dto.DeptQueryCriteria; import org.nl.modules.system.service.dto.DeptQueryCriteria;
import org.nl.modules.system.service.dto.DeptTree; import org.nl.modules.system.service.dto.DeptTree;
import org.nl.modules.system.service.mapstruct.DeptMapper;
import org.nl.modules.tools.MapOf; import org.nl.modules.tools.MapOf;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.ResultBean; import org.nl.modules.wql.core.bean.ResultBean;
@@ -69,11 +60,7 @@ import java.util.stream.Collectors;
@CacheConfig(cacheNames = "dept") @CacheConfig(cacheNames = "dept")
public class DeptServiceImpl implements DeptService { public class DeptServiceImpl implements DeptService {
private final DeptRepository deptRepository;
private final DeptMapper deptMapper;
private final UserRepository userRepository;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final RoleRepository roleRepository;
@Override @Override
public List<Dept> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception { public List<Dept> queryAll(DeptQueryCriteria criteria, Boolean isQuery) throws Exception {
@@ -112,11 +99,6 @@ public class DeptServiceImpl implements DeptService {
} }
@Override
public Set<Dept> findByRoleId(Long id) {
return deptRepository.findByRoleId(id);
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void create(Dept resources) { public void create(Dept resources) {
@@ -164,7 +146,7 @@ public class DeptServiceImpl implements DeptService {
public Set<Dept> getDeleteDepts(List<Dept> menuList, Set<Dept> deptDtos) { public Set<Dept> getDeleteDepts(List<Dept> menuList, Set<Dept> deptDtos) {
for (Dept dept : menuList) { for (Dept dept : menuList) {
deptDtos.add(dept); deptDtos.add(dept);
List<Dept> depts = deptRepository.findByPid(dept.getDept_id()); List<Dept> depts = findByPid(dept.getDept_id());
if (depts != null && depts.size() != 0) { if (depts != null && depts.size() != 0) {
getDeleteDepts(depts, deptDtos); getDeleteDepts(depts, deptDtos);
} }
@@ -259,9 +241,10 @@ public class DeptServiceImpl implements DeptService {
* @param id / * @param id /
*/ */
public void delCaches(Long id) { public void delCaches(Long id) {
List<User> users = userRepository.findByRoleDeptId(id); JSONArray array = WQLObject.getWQLObject("sys_user_dept").query("dept_id ='" + id + "'").getResultJSONArray(0);
Set<Long> users = array.stream().map(a -> ((JSONObject) a).getLong("user_id")).collect(Collectors.toSet());
// 删除数据权限 // 删除数据权限
redisUtils.delByKeys(CacheKey.DATA_USER, users.stream().map(User::getUser_id).collect(Collectors.toSet())); redisUtils.delByKeys(CacheKey.DATA_USER, users);
redisUtils.del(CacheKey.DEPT_ID + id); redisUtils.del(CacheKey.DEPT_ID + id);
} }
@@ -270,7 +253,7 @@ public class DeptServiceImpl implements DeptService {
List<Long> list = new ArrayList<>(); List<Long> list = new ArrayList<>();
deptList.forEach(dept -> { deptList.forEach(dept -> {
if (dept != null && dept.getIs_used()) { if (dept != null && dept.getIs_used()) {
List<Dept> depts = deptRepository.findByPid(dept.getDept_id()); List<Dept> depts = findByPid(dept.getDept_id());
if (deptList.size() != 0) { if (deptList.size() != 0) {
list.addAll(getDeptChildren(depts)); list.addAll(getDeptChildren(depts));
} }

View File

@@ -31,7 +31,6 @@ import org.nl.modules.system.service.RoleService;
import org.nl.modules.system.service.dto.RoleDto; import org.nl.modules.system.service.dto.RoleDto;
import org.nl.modules.system.service.dto.RoleQueryCriteria; import org.nl.modules.system.service.dto.RoleQueryCriteria;
import org.nl.modules.system.service.dto.RoleSmallDto; import org.nl.modules.system.service.dto.RoleSmallDto;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.service.mapstruct.RoleMapper; import org.nl.modules.system.service.mapstruct.RoleMapper;
import org.nl.modules.system.service.mapstruct.RoleSmallMapper; import org.nl.modules.system.service.mapstruct.RoleSmallMapper;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
@@ -41,7 +40,6 @@ import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.util.IdUtil; import org.nl.wms.util.IdUtil;
import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -32,18 +32,14 @@ import org.nl.modules.common.utils.*;
import org.nl.modules.common.utils.dto.CurrentUser; import org.nl.modules.common.utils.dto.CurrentUser;
import org.nl.modules.security.service.OnlineUserService; import org.nl.modules.security.service.OnlineUserService;
import org.nl.modules.system.domain.User; import org.nl.modules.system.domain.User;
import org.nl.modules.system.repository.UserRepository;
import org.nl.modules.system.service.UserService; import org.nl.modules.system.service.UserService;
import org.nl.modules.system.service.dto.RoleSmallDto;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.service.dto.UserQueryCriteria; import org.nl.modules.system.service.dto.UserQueryCriteria;
import org.nl.modules.system.service.mapstruct.UserMapper;
import org.nl.modules.tools.MapOf; import org.nl.modules.tools.MapOf;
import org.nl.modules.wql.WQL; import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject; import org.nl.modules.wql.core.bean.WQLObject;
import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@@ -66,7 +62,6 @@ import java.util.stream.Collectors;
@CacheConfig(cacheNames = "user") @CacheConfig(cacheNames = "user")
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {
private final UserMapper userMapper;
private final FileProperties properties; private final FileProperties properties;
private final RedisUtils redisUtils; private final RedisUtils redisUtils;
private final OnlineUserService onlineUserService; private final OnlineUserService onlineUserService;

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.modules.system.service.mapstruct;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.nl.modules.common.base.BaseMapper;
import org.nl.modules.system.domain.Dept;
import org.nl.modules.system.service.dto.DeptDto;
/**
* @author Zheng Jie
* @date 2019-03-25
*/
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface DeptMapper extends BaseMapper<DeptDto, Dept> {
}

View File

@@ -1,31 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.modules.system.service.mapstruct;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.nl.modules.common.base.BaseMapper;
import org.nl.modules.system.domain.Dept;
import org.nl.modules.system.service.dto.DeptSmallDto;
/**
* @author Zheng Jie
* @date 2019-03-25
*/
@Mapper(componentModel = "spring",unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface DeptSmallMapper extends BaseMapper<DeptSmallDto, Dept> {
}

View File

@@ -25,7 +25,7 @@ import org.nl.modules.system.service.dto.RoleDto;
* @author Zheng Jie * @author Zheng Jie
* @date 2018-11-23 * @date 2018-11-23
*/ */
@Mapper(componentModel = "spring", uses = {MenuMapper.class, DeptMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE) @Mapper(componentModel = "spring", uses = {MenuMapper.class}, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface RoleMapper extends BaseMapper<RoleDto, Role> { public interface RoleMapper extends BaseMapper<RoleDto, Role> {
} }

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.nl.modules.system.service.mapstruct;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
import org.nl.modules.common.base.BaseMapper;
import org.nl.modules.system.domain.User;
import org.nl.modules.system.service.dto.UserDto;
/**
* @author Zheng Jie
* @date 2018-11-23
*/
@Mapper(componentModel = "spring",uses = {RoleMapper.class, DeptMapper.class},unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface UserMapper extends BaseMapper<UserDto, User> {
}

View File

@@ -18,7 +18,7 @@ package org.nl.modules.tools.service.dto;
import lombok.Data; import lombok.Data;
import org.nl.modules.common.annotation.Query; import org.nl.modules.common.annotation.Query;
import java.sql.Timestamp; import java.util.Date;
import java.util.List; import java.util.List;
@@ -33,5 +33,5 @@ public class LocalStorageQueryCriteria{
private String blurry; private String blurry;
@Query(type = Query.Type.BETWEEN) @Query(type = Query.Type.BETWEEN)
private List<Timestamp> createTime; private List<Date> createTime;
} }

View File

@@ -287,10 +287,10 @@ public class ResultBean implements Serializable, Cloneable {
Object value = row.get(key); Object value = row.get(key);
String strValue = WqlUtil.getSQLFieldValue(value).trim(); String strValue = WqlUtil.getSQLFieldValue(value).trim();
if (value instanceof Timestamp) if (value instanceof Date)
//时间处理 //时间处理
if (ObjectUtil.isEmpty(strValue) && ObjectUtil.isNotEmpty(value)) { if (ObjectUtil.isEmpty(strValue) && ObjectUtil.isNotEmpty(value)) {
if (value instanceof Timestamp) { if (value instanceof Date) {
strValue = value.toString(); strValue = value.toString();
} }
} }

View File

@@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.sql.Timestamp; import java.util.Date;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@@ -648,16 +648,16 @@ public class MethodFactory {
// } // }
// } // }
// //
// if (prop.getPropertyType().getName().indexOf("Timestamp") >= 0) { // if (prop.getPropertyType().getName().indexOf("Date") >= 0) {
// //
// Method method = prop.getReadMethod(); // Method method = prop.getReadMethod();
// if (method != null) { // if (method != null) {
// //
// Timestamp date = (Timestamp) (method.invoke(dto, // Date date = (Date) (method.invoke(dto,
// null)); // null));
// //
// if ((date != null) // if ((date != null)
// && (date.before(Timestamp // && (date.before(Date
// .valueOf("1900-01-02 00:00:00.0")))) { // .valueOf("1900-01-02 00:00:00.0")))) {
// //
// method = prop.getWriteMethod(); // method = prop.getWriteMethod();
@@ -969,7 +969,7 @@ public class MethodFactory {
prop.append("double"); prop.append("double");
propValue = "0.0"; propValue = "0.0";
} else if (props[i].getPropertyType().getName().indexOf( } else if (props[i].getPropertyType().getName().indexOf(
"Timestamp") >= 0) { "Date") >= 0) {
prop.append("String"); prop.append("String");
propValue = "\"\""; propValue = "\"\"";
} else { } else {
@@ -1022,7 +1022,7 @@ public class MethodFactory {
PropertyDescriptor[] props = java.beans.Introspector.getBeanInfo( PropertyDescriptor[] props = java.beans.Introspector.getBeanInfo(
inClass).getPropertyDescriptors(); inClass).getPropertyDescriptors();
for (int i = 0; i < props.length; i++) { for (int i = 0; i < props.length; i++) {
if (props[i].getPropertyType().getName().indexOf("Timestamp") >= 0) { if (props[i].getPropertyType().getName().indexOf("Date") >= 0) {
StringBuffer prop = new StringBuffer(); StringBuffer prop = new StringBuffer();
//formreceivedate = MethodFactory.formatDBDate(formreceivedate); //formreceivedate = MethodFactory.formatDBDate(formreceivedate);
prop.append("form" + props[i].getName()); prop.append("form" + props[i].getName());
@@ -1368,8 +1368,6 @@ public class MethodFactory {
// depot.setustcStatus(new Integer(8)); // depot.setustcStatus(new Integer(8));
// depot.setostcInputerid(new Integer(Constants.NULL_INT)); // depot.setostcInputerid(new Integer(Constants.NULL_INT));
// aForm.setForminputdate(formatDBDate(null)); // aForm.setForminputdate(formatDBDate(null));
System.out.println(Timestamp.valueOf("2003-01-01 00:00:00.0")
.compareTo(Timestamp.valueOf("1990-01-02 00:00:00.0")));
//System.out.println(formatDBDate(null)); //System.out.println(formatDBDate(null));
// copyProperties(depot, aForm, false); // copyProperties(depot, aForm, false);
//generateVariable("com.crea.curmedi.biz.struct.stcbBizkeep"); //generateVariable("com.crea.curmedi.biz.struct.stcbBizkeep");

View File

@@ -6,7 +6,7 @@ spring:
druid: druid:
db-type: com.alibaba.druid.pool.DruidDataSource db-type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:nl-sso-server}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:nl-sso-server}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
# url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:yongyu_lms2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:yongyu_lms2}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
username: ${DB_USER:root} username: ${DB_USER:root}
password: ${DB_PWD:P@ssw0rd} password: ${DB_PWD:P@ssw0rd}

View File

@@ -22,6 +22,6 @@ text=String
mediumtext=String mediumtext=String
longtext=String longtext=String
date=Timestamp date=Date
datetime=Timestamp datetime=Date
timestamp=Timestamp Date=Date

File diff suppressed because one or more lines are too long

View File

@@ -1,8 +1,8 @@
package ${package}.service.dto; package ${package}.service.dto;
import lombok.Data; import lombok.Data;
<#if hasTimestamp> <#if hasDate>
import java.sql.Timestamp; import java.util.Date;
</#if> </#if>
<#if hasBigDecimal> <#if hasBigDecimal>
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@@ -13,8 +13,8 @@ import javax.persistence.*;
import javax.persistence.Table; import javax.persistence.Table;
import org.hibernate.annotations.*; import org.hibernate.annotations.*;
</#if> </#if>
<#if hasTimestamp> <#if hasDate>
import java.sql.Timestamp; import java.util.Date;
</#if> </#if>
<#if hasBigDecimal> <#if hasBigDecimal>
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -48,10 +48,10 @@ public class ${className} implements Serializable {
</#if> </#if>
</#if> </#if>
<#if (column.dateAnnotation)?? && column.dateAnnotation != ''> <#if (column.dateAnnotation)?? && column.dateAnnotation != ''>
<#if column.dateAnnotation = 'CreationTimestamp'> <#if column.dateAnnotation = 'CreationDate'>
@CreationTimestamp
<#else> <#else>
@UpdateTimestamp @UpdateDate
</#if> </#if>
</#if> </#if>
<#if column.remark != ''> <#if column.remark != ''>

View File

@@ -2,8 +2,8 @@
package ${package}.service.dto; package ${package}.service.dto;
import lombok.Data; import lombok.Data;
<#if queryHasTimestamp> <#if queryHasDate>
import java.sql.Timestamp; import java.util.Date;
</#if> </#if>
<#if queryHasBigDecimal> <#if queryHasBigDecimal>
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@@ -85,7 +85,7 @@
{{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }} {{ dict.label.${column.dictName}[scope.row.${column.changeColumnName}] }}
</template> </template>
</el-table-column> </el-table-column>
<#elseif column.columnType != 'Timestamp'> <#elseif column.columnType != 'Date'>
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :min-width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')"/> <el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :min-width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')"/>
<#else> <#else>
<el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :min-width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')"> <el-table-column prop="${column.changeColumnName}" label="<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>" :min-width="flexWidth('${column.changeColumnName}',crud.data,'<#if column.remark != ''>${column.remark}<#else>${column.changeColumnName}</#if>')">

View File

@@ -1,7 +1,7 @@
package org.nl.service.dto; package org.nl.service.dto;
import lombok.Data; import lombok.Data;
import java.sql.Timestamp; import java.util.Date;
import java.io.Serializable; import java.io.Serializable;
/** /**
@@ -55,11 +55,11 @@ public class SysUserDto implements Serializable {
private String update_by; private String update_by;
/** 修改密码的时间 */ /** 修改密码的时间 */
private Timestamp pwd_reset_time; private Date pwd_reset_time;
/** 创建日期 */ /** 创建日期 */
private Timestamp create_time; private Date create_time;
/** 更新时间 */ /** 更新时间 */
private Timestamp update_time; private Date update_time;
} }