mirror of
https://gitee.com/log4j/pig.git
synced 2024-12-31 08:14:18 +08:00
Merge remote-tracking branch 'origin/jdk17' into jdk17-dev
# Conflicts: # pig-upms/pig-upms-biz/src/main/java/com/pig4cloud/pig/admin/controller/SysDictController.java
This commit is contained in:
commit
212e1e3633
@ -3,6 +3,7 @@ package com.pig4cloud.pig.admin.api.feign;
|
|||||||
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
|
import com.pig4cloud.pig.admin.api.entity.SysDictItem;
|
||||||
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
|
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
|
import com.pig4cloud.pig.common.feign.annotation.NoToken;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -23,7 +24,8 @@ public interface RemoteDictService {
|
|||||||
* @param type 字典类型
|
* @param type 字典类型
|
||||||
* @return 同类型字典
|
* @return 同类型字典
|
||||||
*/
|
*/
|
||||||
@GetMapping("/dict/type/{type}")
|
@NoToken
|
||||||
|
@GetMapping("/dict/remote/type/{type}")
|
||||||
R<List<SysDictItem>> getDictByType(@PathVariable("type") String type);
|
R<List<SysDictItem>> getDictByType(@PathVariable("type") String type);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ import com.pig4cloud.pig.admin.service.SysDictService;
|
|||||||
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
||||||
import com.pig4cloud.pig.common.core.util.R;
|
import com.pig4cloud.pig.common.core.util.R;
|
||||||
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
import com.pig4cloud.pig.common.log.annotation.SysLog;
|
||||||
import com.pig4cloud.pig.common.security.annotation.HasPermission;
|
import com.pig4cloud.pig.common.security.annotation.Inner;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
||||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -40,6 +40,7 @@ import org.springdoc.core.annotations.ParameterObject;
|
|||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.http.HttpHeaders;
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -65,6 +66,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过ID查询字典信息
|
* 通过ID查询字典信息
|
||||||
|
*
|
||||||
* @param id ID
|
* @param id ID
|
||||||
* @return 字典信息
|
* @return 字典信息
|
||||||
*/
|
*/
|
||||||
@ -75,6 +77,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询字典信息
|
* 查询字典信息
|
||||||
|
*
|
||||||
* @param query 查询信息
|
* @param query 查询信息
|
||||||
* @return 字典信息
|
* @return 字典信息
|
||||||
*/
|
*/
|
||||||
@ -85,6 +88,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询字典信息
|
* 分页查询字典信息
|
||||||
|
*
|
||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @return 分页对象
|
* @return 分页对象
|
||||||
*/
|
*/
|
||||||
@ -96,25 +100,16 @@ public class SysDictController {
|
|||||||
.like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType())));
|
.like(StrUtil.isNotBlank(sysDict.getDictType()), SysDict::getDictType, sysDict.getDictType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过字典类型查找字典
|
|
||||||
* @param type 类型
|
|
||||||
* @return 同类型字典
|
|
||||||
*/
|
|
||||||
@GetMapping("/type/{type}")
|
|
||||||
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
|
|
||||||
public R<List<SysDictItem>> getDictByType(@PathVariable String type) {
|
|
||||||
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictType, type)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加字典
|
* 添加字典
|
||||||
|
*
|
||||||
* @param sysDict 字典信息
|
* @param sysDict 字典信息
|
||||||
* @return success、false
|
* @return success、false
|
||||||
*/
|
*/
|
||||||
@SysLog("添加字典")
|
@SysLog("添加字典")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@HasPermission("sys_dict_add")
|
@PreAuthorize("@pms.hasPermission('sys_dict_add')")
|
||||||
public R save(@Valid @RequestBody SysDict sysDict) {
|
public R save(@Valid @RequestBody SysDict sysDict) {
|
||||||
sysDictService.save(sysDict);
|
sysDictService.save(sysDict);
|
||||||
return R.ok(sysDict);
|
return R.ok(sysDict);
|
||||||
@ -122,12 +117,13 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除字典,并且清除字典缓存
|
* 删除字典,并且清除字典缓存
|
||||||
|
*
|
||||||
* @param ids ID
|
* @param ids ID
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@SysLog("删除字典")
|
@SysLog("删除字典")
|
||||||
@DeleteMapping
|
@DeleteMapping
|
||||||
@HasPermission("sys_dict_del")
|
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
|
||||||
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
@CacheEvict(value = CacheConstants.DICT_DETAILS, allEntries = true)
|
||||||
public R removeById(@RequestBody Long[] ids) {
|
public R removeById(@RequestBody Long[] ids) {
|
||||||
return R.ok(sysDictService.removeDictByIds(ids));
|
return R.ok(sysDictService.removeDictByIds(ids));
|
||||||
@ -135,18 +131,20 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典
|
* 修改字典
|
||||||
|
*
|
||||||
* @param sysDict 字典信息
|
* @param sysDict 字典信息
|
||||||
* @return success/false
|
* @return success/false
|
||||||
*/
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@SysLog("修改字典")
|
@SysLog("修改字典")
|
||||||
@HasPermission("sys_dict_edit")
|
@PreAuthorize("@pms.hasPermission('sys_dict_edit')")
|
||||||
public R updateById(@Valid @RequestBody SysDict sysDict) {
|
public R updateById(@Valid @RequestBody SysDict sysDict) {
|
||||||
return sysDictService.updateDict(sysDict);
|
return sysDictService.updateDict(sysDict);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
* @param name 名称或者字典项
|
* @param name 名称或者字典项
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -160,6 +158,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
|
*
|
||||||
* @param page 分页对象
|
* @param page 分页对象
|
||||||
* @param sysDictItem 字典项
|
* @param sysDictItem 字典项
|
||||||
* @return
|
* @return
|
||||||
@ -171,6 +170,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id查询字典项
|
* 通过id查询字典项
|
||||||
|
*
|
||||||
* @param id id
|
* @param id id
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@ -181,6 +181,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询字典项详情
|
* 查询字典项详情
|
||||||
|
*
|
||||||
* @param query 查询条件
|
* @param query 查询条件
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@ -191,6 +192,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增字典项
|
* 新增字典项
|
||||||
|
*
|
||||||
* @param sysDictItem 字典项
|
* @param sysDictItem 字典项
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@ -203,6 +205,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改字典项
|
* 修改字典项
|
||||||
|
*
|
||||||
* @param sysDictItem 字典项
|
* @param sysDictItem 字典项
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@ -214,6 +217,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过id删除字典项
|
* 通过id删除字典项
|
||||||
|
*
|
||||||
* @param id id
|
* @param id id
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@ -225,6 +229,7 @@ public class SysDictController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 同步缓存字典
|
* 同步缓存字典
|
||||||
|
*
|
||||||
* @return R
|
* @return R
|
||||||
*/
|
*/
|
||||||
@SysLog("同步字典")
|
@SysLog("同步字典")
|
||||||
@ -239,4 +244,29 @@ public class SysDictController {
|
|||||||
return sysDictItemService.list(Wrappers.query(sysDictItem));
|
return sysDictItemService.list(Wrappers.query(sysDictItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典类型查找字典
|
||||||
|
*
|
||||||
|
* @param type 类型
|
||||||
|
* @return 同类型字典
|
||||||
|
*/
|
||||||
|
@GetMapping("/type/{type}")
|
||||||
|
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
|
||||||
|
public R<List<SysDictItem>> getDictByType(@PathVariable String type) {
|
||||||
|
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictType, type)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过字典类型查找字典 (针对feign调用)
|
||||||
|
* TODO: 兼容性方案,代码重复
|
||||||
|
* @param type 类型
|
||||||
|
* @return 同类型字典
|
||||||
|
*/
|
||||||
|
@Inner
|
||||||
|
@GetMapping("/remote/type/{type}")
|
||||||
|
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type", unless = "#result.data.isEmpty()")
|
||||||
|
public R<List<SysDictItem>> getRemoteDictByType(@PathVariable String type) {
|
||||||
|
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getDictType, type)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user