master:系统调优;
parent
178ad50c12
commit
ac3e79e819
|
|
@ -15,6 +15,7 @@ import com.ruoyi.system.service.ISysDictTypeService;
|
|||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -34,6 +35,7 @@ public class SysDictDataController extends BaseController {
|
|||
final ISysDictDataService dictDataService;
|
||||
final ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "新增字典明细类型", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "新增字典明细类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -41,6 +43,7 @@ public class SysDictDataController extends BaseController {
|
|||
return R.ok(dictDataService.create(BeanUtil.toBean(dataVO, DictDataDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "修改字典明细类型", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "修改字典明细类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -48,6 +51,7 @@ public class SysDictDataController extends BaseController {
|
|||
return R.ok(dictDataService.update(BeanUtil.toBean(dataVO, DictDataDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "删除字典明细类型", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "删除字典明细类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping()
|
||||
|
|
@ -55,12 +59,14 @@ public class SysDictDataController extends BaseController {
|
|||
return R.ok(dictDataService.delete(BeanUtil.toBean(deleteVO, DictDataDeleteDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "查询字典数据详细", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/{dictDataId}")
|
||||
public R<DictDataResVO> getInfo(@PathVariable Long dictDataId) {
|
||||
return R.ok(BeanUtil.toBean(dictDataService.selectById(dictDataId), DictDataResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
@ApiOperation(value = "根据字典类型查询字典数据信息", httpMethod = "GET", response = R.class)
|
||||
public R<List<DictDataResVO>> dictType(@PathVariable String dictType) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class SysDictTypeController extends BaseController {
|
|||
|
||||
final ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "新增字典类型", httpMethod = "POST", response = R.class)
|
||||
@Log(title = "新增字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
|
|
@ -41,14 +41,14 @@ public class SysDictTypeController extends BaseController {
|
|||
return R.ok(dictTypeService.create(BeanUtil.toBean(dictTypeVO, DictTypeDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "查询字典类型列表", httpMethod = "POST", response = R.class)
|
||||
@PostMapping("/page")
|
||||
public R<Page<DictTypePageResVO>> page(@Validated @RequestBody DictTypePageVO pageVO) {
|
||||
return R.ok(dictTypeService.page(BeanUtil.toBean(pageVO, DictTypePageDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "修改字典类型", httpMethod = "PUT", response = R.class)
|
||||
@Log(title = "修改字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
|
|
@ -56,7 +56,7 @@ public class SysDictTypeController extends BaseController {
|
|||
return R.ok(dictTypeService.update(BeanUtil.toBean(dictTypeVO, DictTypeDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "删除字典类型", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping()
|
||||
|
|
@ -64,14 +64,13 @@ public class SysDictTypeController extends BaseController {
|
|||
return R.ok(dictTypeService.delete(BeanUtil.toBean(deleteVO, DictTypeDeleteDTO.class)));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "查询字典类型详细", httpMethod = "GET", response = R.class)
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public R<DictTypeResVO> getInfo(@PathVariable Long dictId) {
|
||||
return R.ok(BeanUtil.toBean(dictTypeService.selectById(dictId), DictTypeResVO.class));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@ApiOperation(value = "刷新字典缓存", httpMethod = "DELETE", response = R.class)
|
||||
@Log(title = "刷新字典缓存", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/refreshCache")
|
||||
|
|
@ -80,6 +79,7 @@ public class SysDictTypeController extends BaseController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
|
||||
@ApiOperation(value = "获取字典选择框列表", httpMethod = "DELETE", response = R.class)
|
||||
@GetMapping("/optionselect")
|
||||
public R<List<DictTypeResVO>> optionSelect() {
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ public class AdvertCreateVO {
|
|||
@NotNull(message = "播放轮次展示类型不能为空!")
|
||||
@ApiModelProperty(value = "播放轮次展示类型 1 时间范围or 2位置枚举", required = true)
|
||||
private Integer showType;
|
||||
@NotNull(message = "prodMaxNum不能为空!")
|
||||
@ApiModelProperty(value = "播放商品,或者图及商品 最多可容纳的商品数量", required = true)
|
||||
@ApiModelProperty(value = "播放商品,或者图及商品 最多可容纳的商品数量")
|
||||
private Integer prodMaxNum;
|
||||
@NotNull(message = "展示类型不能为空!")
|
||||
@ApiModelProperty(value = "展示类型 1推广图、2商品、3推广图及商品", required = true)
|
||||
|
|
|
|||
|
|
@ -22,15 +22,13 @@ import com.ruoyi.system.mapper.SysDictDataMapper;
|
|||
import com.ruoyi.system.mapper.SysDictTypeMapper;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
||||
|
|
@ -112,6 +110,15 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
|||
SysDictType dict = Optional.ofNullable(this.dictTypeMapper.selectOne(new LambdaQueryWrapper<SysDictType>()
|
||||
.eq(SysDictType::getDictId, typeDTO.getDictId()).eq(SysDictType::getDelFlag, Constants.UNDELETED)))
|
||||
.orElseThrow(() -> new ServiceException("字典类型不存在!", HttpStatus.ERROR));
|
||||
// 如果字典类型被修改,则同步修改sys_dict_data中的数据
|
||||
if (!Objects.equals(dict.getDictType(), typeDTO.getDictType())) {
|
||||
List<SysDictData> dataList = this.dictDataMapper.selectList(new LambdaQueryWrapper<SysDictData>()
|
||||
.eq(SysDictData::getDictType, dict.getDictType()).eq(SysDictData::getDelFlag, Constants.UNDELETED));
|
||||
if (CollectionUtils.isNotEmpty(dataList)) {
|
||||
dataList.forEach(x -> x.setDictType(typeDTO.getDictType()));
|
||||
this.dictDataMapper.updateById(dataList);
|
||||
}
|
||||
}
|
||||
dict.setUpdateBy(getUsername());
|
||||
BeanUtil.copyProperties(typeDTO, dict);
|
||||
return this.dictTypeMapper.updateById(dict);
|
||||
|
|
|
|||
Loading…
Reference in New Issue