publish 0.9.3
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
package com.tiesheng.core.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||
import com.tiesheng.core.pojos.dto.config.ConfigFuncDTO;
|
||||
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
|
||||
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
||||
import com.tiesheng.core.service.CoreConfigService;
|
||||
@@ -16,6 +19,7 @@ import com.tiesheng.util.pojos.ApiResp;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -95,4 +99,34 @@ public class ConfigController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能点列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/func/list")
|
||||
public ApiResp<List<CoreConfigFunc>> funcList(Integer isUsed, PageDTO dto) {
|
||||
QueryWrapper<CoreConfigFunc> queryWrapper = new QueryWrapper<CoreConfigFunc>().eq("is_deleted", 0);
|
||||
if (isUsed != null) {
|
||||
queryWrapper.eq("is_used", isUsed);
|
||||
}
|
||||
dto.likeColumns(queryWrapper, "name");
|
||||
Page<CoreConfigFunc> page = dto.pageObj();
|
||||
coreConfigService.getFuncMapper().selectPage(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能点更新
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/func/update")
|
||||
public ApiResp<String> funcUpdate(@Valid @RequestBody ConfigFuncDTO dto) {
|
||||
CoreConfigFunc configFunc = BeanUtil.copyProperties(dto, CoreConfigFunc.class);
|
||||
coreConfigService.getFuncMapper().updateById(configFunc);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
||||
import com.tiesheng.core.pojos.dao.CoreJobPoint;
|
||||
import com.tiesheng.core.pojos.dto.IdDTO;
|
||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
||||
import com.tiesheng.core.pojos.dto.job.JobUpdateDTO;
|
||||
import com.tiesheng.core.pojos.dto.job.JobUpdateRxDTO;
|
||||
import com.tiesheng.core.pojos.dto.job.JobUserAssignDTO;
|
||||
import com.tiesheng.core.pojos.dto.job.JobUserOwner;
|
||||
import com.tiesheng.core.service.JobService;
|
||||
import com.tiesheng.core.service.CoreJobService;
|
||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
@@ -29,7 +28,7 @@ import java.util.List;
|
||||
public class JobController {
|
||||
|
||||
@Autowired
|
||||
JobService jobService;
|
||||
CoreJobService coreJobService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -41,7 +40,7 @@ public class JobController {
|
||||
public ApiResp<List<CoreJob>> list(PageDTO dto) {
|
||||
QueryWrapper<CoreJob> queryWrapper = new QueryWrapper<CoreJob>().eq("is_deleted", 0);
|
||||
dto.likeColumns(queryWrapper, "name");
|
||||
List<CoreJob> jobList = jobService.list(queryWrapper);
|
||||
List<CoreJob> jobList = coreJobService.list(queryWrapper);
|
||||
return ApiResp.respOK(jobList);
|
||||
}
|
||||
|
||||
@@ -55,39 +54,25 @@ public class JobController {
|
||||
public ApiResp<String> update(@Valid @RequestBody JobUpdateDTO dto) {
|
||||
CoreJob job = BeanUtil.copyProperties(dto, CoreJob.class);
|
||||
if (!StrUtil.isEmpty(job.getId())) {
|
||||
CoreJob byId = jobService.getById(job.getId());
|
||||
CoreJob byId = coreJobService.getById(job.getId());
|
||||
if (byId != null && byId.getIsSystem() == 1) {
|
||||
throw new ApiException("系统配置,无法编辑");
|
||||
}
|
||||
}
|
||||
jobService.saveOrUpdate(job);
|
||||
coreJobService.saveOrUpdate(job);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取职位功能点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/point/list")
|
||||
public ApiResp<List<CoreJobPoint>> pointList() {
|
||||
List<CoreJobPoint> pointList = jobService.getJobPointMapper().selectList(new QueryWrapper<CoreJobPoint>()
|
||||
.eq("is_deleted", 0)
|
||||
);
|
||||
return ApiResp.respOK(pointList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取关系
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/point/rx")
|
||||
public ApiResp<List<String>> pointRx(@Valid IdDTO dto) {
|
||||
List<String> list = jobService.getJobPointMapper().getJobRx(dto.getId());
|
||||
@GetMapping("/func/rx")
|
||||
public ApiResp<List<String>> funcRx(@Valid IdDTO dto) {
|
||||
List<String> list = coreJobService.getBaseMapper().getJobFunc(dto.getId());
|
||||
return ApiResp.respOK(list);
|
||||
}
|
||||
|
||||
@@ -97,9 +82,9 @@ public class JobController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/point/rx")
|
||||
@PostMapping("/func/rx")
|
||||
public ApiResp<String> updateJobRx(@Valid @RequestBody JobUpdateRxDTO dto) {
|
||||
jobService.updateJobRx(dto.getJobId(), StrUtil.split(dto.getPoints(), ","));
|
||||
coreJobService.updateJobRx(dto.getJobId(), StrUtil.split(dto.getPoints(), ","));
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
@@ -111,7 +96,7 @@ public class JobController {
|
||||
*/
|
||||
@PostMapping("/user/assign")
|
||||
public ApiResp<String> userAssign(@Valid @RequestBody JobUserAssignDTO dto) {
|
||||
jobService.userAssign(dto.getUserId(), dto.getJobId());
|
||||
coreJobService.userAssign(dto.getUserId(), dto.getJobId());
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
@@ -123,9 +108,9 @@ public class JobController {
|
||||
*/
|
||||
@GetMapping("/user/owner")
|
||||
public ApiResp<List<JobUserOwner>> userOwner() {
|
||||
List<JobUserOwner> coreJobUsers = jobService.getJobUserMapper().list(TsTokenConfig.get().getId());
|
||||
List<JobUserOwner> coreJobUsers = coreJobService.getJobUserMapper().list(TsTokenConfig.get().getId());
|
||||
coreJobUsers.forEach(it -> {
|
||||
List<String> list = jobService.getJobPointMapper().getJobRx(it.getJobId());
|
||||
List<String> list = coreJobService.getBaseMapper().getJobFunc(it.getJobId());
|
||||
it.setPoints(list);
|
||||
});
|
||||
return ApiResp.respOK(coreJobUsers);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
||||
import com.tiesheng.util.pojos.IdName;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoreConfigFuncMapper extends BaseMapper<CoreConfigFunc> {
|
||||
}
|
||||
@@ -2,6 +2,35 @@ package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
||||
import com.tiesheng.util.pojos.IdName;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoreJobMapper extends BaseMapper<CoreJob> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除职位的关联关系
|
||||
*
|
||||
* @param jobId
|
||||
*/
|
||||
void clearJobFunc(@Param("jobId") String jobId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新关联关系
|
||||
*
|
||||
* @param pointList
|
||||
*/
|
||||
void updateJobFunc(@Param("list") List<IdName> pointList);
|
||||
|
||||
|
||||
/**
|
||||
* 获取关联的func
|
||||
*
|
||||
* @param jobId
|
||||
* @return
|
||||
*/
|
||||
List<String> getJobFunc(@Param("jobId") String jobId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.tiesheng.core.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreJobPoint;
|
||||
import com.tiesheng.util.pojos.IdName;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoreJobPointMapper extends BaseMapper<CoreJobPoint> {
|
||||
|
||||
|
||||
/**
|
||||
* 清除职位的关联关系
|
||||
*
|
||||
* @param jobId
|
||||
*/
|
||||
void clearJobRx(@Param("jobId") String jobId);
|
||||
|
||||
|
||||
/**
|
||||
* 更新关联关系
|
||||
*
|
||||
* @param pointList
|
||||
*/
|
||||
void updateJobRx(@Param("list") List<IdName> pointList);
|
||||
|
||||
|
||||
/**
|
||||
* 获取关联的point
|
||||
*
|
||||
* @param jobId
|
||||
* @return
|
||||
*/
|
||||
List<String> getJobRx(@Param("jobId") String jobId);
|
||||
|
||||
}
|
||||
@@ -8,10 +8,10 @@ import com.tiesheng.core.pojos.DaoBase;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 职位-功能点
|
||||
*/
|
||||
@TableName(value = "core_job_point")
|
||||
public class CoreJobPoint extends DaoBase {
|
||||
* 职位-功能点
|
||||
*/
|
||||
@TableName(value = "core_config_func")
|
||||
public class CoreConfigFunc extends DaoBase {
|
||||
/**
|
||||
* 业务
|
||||
*/
|
||||
@@ -30,6 +30,12 @@ public class CoreJobPoint extends DaoBase {
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@TableField(value = "is_used")
|
||||
private Integer isUsed;
|
||||
|
||||
/**
|
||||
* 获取业务
|
||||
*
|
||||
@@ -83,4 +89,22 @@ public class CoreJobPoint extends DaoBase {
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否启用
|
||||
*
|
||||
* @return is_used - 是否启用
|
||||
*/
|
||||
public Integer getIsUsed() {
|
||||
return isUsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否启用
|
||||
*
|
||||
* @param isUsed 是否启用
|
||||
*/
|
||||
public void setIsUsed(Integer isUsed) {
|
||||
this.isUsed = isUsed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.tiesheng.core.pojos.dto.config;
|
||||
|
||||
public class ConfigFuncDTO {
|
||||
|
||||
private String id;
|
||||
private String service;
|
||||
private String name;
|
||||
private String remark;
|
||||
private Integer isUsed;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getService() {
|
||||
return service;
|
||||
}
|
||||
|
||||
public void setService(String service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public Integer getIsUsed() {
|
||||
return isUsed;
|
||||
}
|
||||
|
||||
public void setIsUsed(Integer isUsed) {
|
||||
this.isUsed = isUsed;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.tiesheng.core.service;
|
||||
|
||||
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
||||
import com.tiesheng.core.mapper.CoreConfigFuncMapper;
|
||||
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -14,8 +16,37 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
||||
|
||||
@Autowired
|
||||
CoreConfigEnumMapper coreConfigEnumMapper;
|
||||
@Autowired
|
||||
CoreConfigFuncMapper coreConfigFuncMapper;
|
||||
|
||||
public CoreConfigEnumMapper getEnumMapper() {
|
||||
return coreConfigEnumMapper;
|
||||
}
|
||||
|
||||
public CoreConfigFuncMapper getFuncMapper() {
|
||||
return coreConfigFuncMapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新功能点
|
||||
*
|
||||
* @param id
|
||||
* @param service
|
||||
* @param name
|
||||
* @param remark
|
||||
*/
|
||||
public void refreshFunc(String id, String service, String name, String remark) {
|
||||
CoreConfigFunc jobPoint = new CoreConfigFunc();
|
||||
jobPoint.setId(id);
|
||||
jobPoint.setService(service);
|
||||
jobPoint.setName(name);
|
||||
jobPoint.setRemark(remark);
|
||||
try {
|
||||
coreConfigFuncMapper.insert(jobPoint);
|
||||
} catch (Exception e) {
|
||||
coreConfigFuncMapper.updateById(jobPoint);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,8 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.tiesheng.core.mapper.CoreJobMapper;
|
||||
import com.tiesheng.core.mapper.CoreJobPointMapper;
|
||||
import com.tiesheng.core.mapper.CoreJobUserMapper;
|
||||
import com.tiesheng.core.pojos.dao.CoreJob;
|
||||
import com.tiesheng.core.pojos.dao.CoreJobPoint;
|
||||
import com.tiesheng.core.pojos.dao.CoreJobUser;
|
||||
import com.tiesheng.util.pojos.IdName;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -21,17 +19,11 @@ import java.util.List;
|
||||
* @author hao
|
||||
*/
|
||||
@Service
|
||||
public class JobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
||||
public class CoreJobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
||||
|
||||
@Autowired
|
||||
CoreJobPointMapper coreJobPointMapper;
|
||||
@Autowired
|
||||
CoreJobUserMapper coreJobUserMapper;
|
||||
|
||||
public CoreJobPointMapper getJobPointMapper() {
|
||||
return coreJobPointMapper;
|
||||
}
|
||||
|
||||
public CoreJobUserMapper getJobUserMapper() {
|
||||
return coreJobUserMapper;
|
||||
}
|
||||
@@ -43,41 +35,15 @@ public class JobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
||||
* @param remark
|
||||
* @param isSystem
|
||||
*/
|
||||
public void refresh(String id, String name, String remark, Integer isSystem, List<String> points) {
|
||||
public void refresh(String id, String name, String remark, Integer isSystem) {
|
||||
CoreJob coreJob = new CoreJob();
|
||||
coreJob.setId(id);
|
||||
coreJob.setName(name);
|
||||
coreJob.setRemark(remark);
|
||||
coreJob.setIsSystem(isSystem);
|
||||
saveOrUpdate(coreJob);
|
||||
|
||||
// 增加关联关系
|
||||
updateJobRx(coreJob.getId(), points);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新功能点
|
||||
*
|
||||
* @param id
|
||||
* @param service
|
||||
* @param name
|
||||
* @param remark
|
||||
*/
|
||||
public void refreshPoint(String id, String service, String name, String remark) {
|
||||
CoreJobPoint jobPoint = new CoreJobPoint();
|
||||
jobPoint.setId(id);
|
||||
jobPoint.setService(service);
|
||||
jobPoint.setName(name);
|
||||
jobPoint.setRemark(remark);
|
||||
try {
|
||||
coreJobPointMapper.insert(jobPoint);
|
||||
} catch (Exception e) {
|
||||
coreJobPointMapper.updateById(jobPoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新关联关系
|
||||
*
|
||||
@@ -96,9 +62,9 @@ public class JobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
||||
if (StrUtil.isEmpty(jobId)) {
|
||||
return;
|
||||
}
|
||||
coreJobPointMapper.clearJobRx(jobId);
|
||||
getBaseMapper().clearJobFunc(jobId);
|
||||
if (CollUtil.isNotEmpty(nameList)) {
|
||||
coreJobPointMapper.updateJobRx(nameList);
|
||||
getBaseMapper().updateJobFunc(nameList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user