代码提交
This commit is contained in:
@@ -18,7 +18,6 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "codeDetail")
|
||||
public class CodeDetailServiceImpl implements CodeDetailService {
|
||||
@Override
|
||||
public JSONObject queryAll(Map form, Pageable pageable) {
|
||||
|
||||
@@ -37,7 +37,6 @@ import java.util.Set;
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "data")
|
||||
public class DataServiceImpl implements DataService {
|
||||
|
||||
private final RoleService roleService;
|
||||
|
||||
@@ -57,7 +57,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "dept")
|
||||
public class DeptServiceImpl implements DeptService {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@@ -40,18 +40,17 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
* @author Zheng Jie
|
||||
* @date 2019-04-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "dict")
|
||||
public class DictDetailServiceImpl implements DictDetailService {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
||||
public Map<String, Object> queryAll(DictDetailQueryCriteria criteria, Pageable pageable) {
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("flag", "2");
|
||||
map.put("code", criteria.getCode());
|
||||
@@ -66,7 +65,7 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
// 校验是否已经有标签
|
||||
JSONObject object = wo.query("label = '" + resources.getLabel() + "' " +
|
||||
"AND code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("标签["+ resources.getLabel() + "]已存在");
|
||||
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("标签[" + resources.getLabel() + "]已存在");
|
||||
JSONObject dictObj = wo.query("code = '" + resources.getDictCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(dictObj.getString("label"))) {
|
||||
// 空就赋值
|
||||
@@ -141,9 +140,10 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
dictTab.delete(json);
|
||||
}
|
||||
|
||||
public void delCaches(DictDto dict){
|
||||
public void delCaches(DictDto dict) {
|
||||
redisUtils.del("dict::name:" + dict.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictDto findById(Long dict_id) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||
|
||||
@@ -48,7 +48,6 @@ import java.util.*;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
//@CacheConfig(cacheNames = "dict")
|
||||
public class DictServiceImpl implements DictService {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "menu")
|
||||
public class MenuServiceImpl implements MenuService {
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.nl.modules.system.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -24,14 +23,8 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.CacheKey;
|
||||
import org.nl.modules.common.utils.RedisUtils;
|
||||
import org.nl.modules.common.utils.SecurityUtils;
|
||||
import org.nl.modules.system.domain.Role;
|
||||
import org.nl.modules.system.domain.User;
|
||||
import org.nl.modules.system.service.RoleService;
|
||||
import org.nl.modules.system.service.dto.RoleDto;
|
||||
import org.nl.modules.system.service.dto.RoleSmallDto;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.ResultBean;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
@@ -41,9 +34,9 @@ import org.springframework.cache.annotation.CacheConfig;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author ludj
|
||||
@@ -51,11 +44,8 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "role")
|
||||
public class RoleServiceImpl implements RoleService {
|
||||
|
||||
private final RedisUtils redisUtils;
|
||||
|
||||
@Override
|
||||
public JSONObject queryAll(Map whereJson, Pageable page) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_role");
|
||||
@@ -94,7 +84,6 @@ public class RoleServiceImpl implements RoleService {
|
||||
form.put("update_name", SecurityUtils.getCurrentNickName());
|
||||
form.put("update_time", DateUtil.now());
|
||||
roleTab.insert(form);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -61,7 +61,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@CacheConfig(cacheNames = "user")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
private final FileProperties properties;
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.db.Db;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQLCore;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.springframework.jdbc.datasource.DataSourceUtils;
|
||||
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
@@ -78,8 +80,8 @@ public class DBPoolSpring {
|
||||
Connection conn = null;
|
||||
try {
|
||||
DataSource dataSource = SpringContextHolder.getBean(name);
|
||||
conn=Db.use(dataSource).getConnection();
|
||||
// conn = DataSourceUtils.getConnection(dataSource);
|
||||
// conn=Db.use(dataSource).getConnection();
|
||||
conn = DataSourceUtils.getConnection(dataSource);
|
||||
} catch (Exception e) {
|
||||
log.error("不能获得Spring连接池中的数据库连接:" + e.toString());
|
||||
}
|
||||
@@ -120,9 +122,10 @@ public class DBPoolSpring {
|
||||
// conn.close();
|
||||
// }
|
||||
DataSource dataSource = (DataSource) SpringContextHolder.getBean(name);
|
||||
// DataSourceUtils.releaseConnection(conn, dataSource);
|
||||
DataSourceUtils.releaseConnection(conn, dataSource);
|
||||
|
||||
Db.use(dataSource).closeConnection(conn);
|
||||
|
||||
/* Db.use(dataSource).closeConnection(conn);*/
|
||||
// } catch (SQLException e) {
|
||||
// log.error("数据库连接关闭:"+e.toString() );
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user