mirror of https://gitee.com/stylefeng/roses
【app】更新app业务
parent
41bf173cf4
commit
9432ae22aa
|
@ -1,4 +1,4 @@
|
|||
package cn.stylefeng.roses.kernel.system.pojo;
|
||||
package cn.stylefeng.roses.kernel.system.pojo.app;
|
||||
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||
import cn.stylefeng.roses.kernel.validator.validators.status.StatusValue;
|
|
@ -6,7 +6,7 @@ import cn.stylefeng.roses.kernel.resource.api.annotation.GetResource;
|
|||
import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.SysAppRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.app.SysAppRequest;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -62,6 +62,18 @@ public class SysAppController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用状态
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/6/29 16:49
|
||||
*/
|
||||
@PostResource(name = "修改应用状态", path = "/sysApp/updateStatus")
|
||||
public ResponseData updateStatus(@RequestBody @Validated(SysAppRequest.updateStatus.class) SysAppRequest sysAppParam) {
|
||||
sysAppService.editStatus(sysAppParam);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看系统应用
|
||||
*
|
||||
|
@ -107,16 +119,4 @@ public class SysAppController {
|
|||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改应用状态
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2020/6/29 16:49
|
||||
*/
|
||||
@PostResource(name = "修改应用状态", path = "/sysApp/updateStatus")
|
||||
public ResponseData updateStatus(@RequestBody @Validated(SysAppRequest.updateStatus.class) SysAppRequest sysAppParam) {
|
||||
sysAppService.updateStatus(sysAppParam);
|
||||
return new SuccessResponseData();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ package cn.stylefeng.roses.kernel.app.modular.service;
|
|||
|
||||
import cn.stylefeng.roses.kernel.app.modular.entity.SysApp;
|
||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.SysAppRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.app.SysAppRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -66,6 +66,15 @@ public interface SysAppService extends IService<SysApp> {
|
|||
*/
|
||||
void edit(SysAppRequest sysAppParam);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*
|
||||
* @param sysAppParam 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 14:30
|
||||
*/
|
||||
void editStatus(SysAppRequest sysAppParam);
|
||||
|
||||
/**
|
||||
* 查看系统应用
|
||||
*
|
||||
|
@ -105,13 +114,4 @@ public interface SysAppService extends IService<SysApp> {
|
|||
*/
|
||||
void updateActiveFlag(SysAppRequest sysAppParam);
|
||||
|
||||
/**
|
||||
* 更新状态
|
||||
*
|
||||
* @param sysAppParam 请求参数
|
||||
* @author fengshuonan
|
||||
* @date 2021/1/6 14:30
|
||||
*/
|
||||
void updateStatus(SysAppRequest sysAppParam);
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import cn.stylefeng.roses.kernel.system.AppServiceApi;
|
|||
import cn.stylefeng.roses.kernel.system.MenuServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.exception.SystemModularException;
|
||||
import cn.stylefeng.roses.kernel.system.exception.enums.AppExceptionEnum;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.SysAppRequest;
|
||||
import cn.stylefeng.roses.kernel.system.pojo.app.SysAppRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
@ -94,6 +94,20 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
|
|||
this.updateById(sysApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editStatus(SysAppRequest sysAppParam) {
|
||||
SysApp currentApp = this.querySysApp(sysAppParam);
|
||||
|
||||
// 激活状态的不能被禁用
|
||||
if (YesOrNotEnum.Y.getCode().equals(currentApp.getActiveFlag())
|
||||
&& StatusEnum.DISABLE.getCode().equals(sysAppParam.getStatusFlag())) {
|
||||
throw new SystemModularException(AppExceptionEnum.CANT_DISABLE);
|
||||
}
|
||||
|
||||
currentApp.setStatusFlag(sysAppParam.getStatusFlag());
|
||||
this.updateById(currentApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysApp detail(SysAppRequest sysAppRequest) {
|
||||
return this.querySysApp(sysAppRequest);
|
||||
|
@ -128,27 +142,13 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
|
|||
this.updateById(currentApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(SysAppRequest sysAppParam) {
|
||||
SysApp currentApp = this.querySysApp(sysAppParam);
|
||||
|
||||
// 激活状态的不能被禁用
|
||||
if (YesOrNotEnum.Y.getCode().equals(currentApp.getActiveFlag())
|
||||
&& StatusEnum.DISABLE.getCode().equals(sysAppParam.getStatusFlag())) {
|
||||
throw new SystemModularException(AppExceptionEnum.CANT_DISABLE);
|
||||
}
|
||||
|
||||
currentApp.setStatusFlag(sysAppParam.getStatusFlag());
|
||||
this.updateById(currentApp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<SimpleDict> getAppsByAppCodes(Set<String> appCodes) {
|
||||
HashSet<SimpleDict> simpleDicts = new HashSet<>();
|
||||
|
||||
LambdaQueryWrapper<SysApp> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(SysApp::getAppCode, appCodes);
|
||||
queryWrapper.select(SysApp::getAppCode, SysApp::getAppId, SysApp::getAppName);
|
||||
queryWrapper.select(SysApp::getAppId, SysApp::getAppCode, SysApp::getAppName);
|
||||
|
||||
List<SysApp> list = this.list(queryWrapper);
|
||||
for (SysApp sysApp : list) {
|
||||
|
@ -219,26 +219,23 @@ public class SysAppServiceImpl extends ServiceImpl<SysAppMapper, SysApp> impleme
|
|||
*/
|
||||
private LambdaQueryWrapper<SysApp> createWrapper(SysAppRequest sysAppRequest) {
|
||||
LambdaQueryWrapper<SysApp> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(sysAppRequest)) {
|
||||
// 根据id查询
|
||||
if (ObjectUtil.isNotEmpty(sysAppRequest.getAppId())) {
|
||||
queryWrapper.eq(SysApp::getAppId, sysAppRequest.getAppId());
|
||||
}
|
||||
|
||||
// 根据名称模糊查询
|
||||
if (ObjectUtil.isNotEmpty(sysAppRequest.getAppName())) {
|
||||
queryWrapper.like(SysApp::getAppName, sysAppRequest.getAppName());
|
||||
}
|
||||
|
||||
// 根据编码模糊查询
|
||||
if (ObjectUtil.isNotEmpty(sysAppRequest.getAppCode())) {
|
||||
queryWrapper.like(SysApp::getAppCode, sysAppRequest.getAppCode());
|
||||
}
|
||||
}
|
||||
|
||||
// 查询未删除状态的
|
||||
queryWrapper.eq(SysApp::getDelFlag, YesOrNotEnum.N.getCode());
|
||||
|
||||
if (ObjectUtil.isEmpty(sysAppRequest)) {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
// 根据id查询
|
||||
queryWrapper.eq(ObjectUtil.isNotEmpty(sysAppRequest.getAppId()), SysApp::getAppId, sysAppRequest.getAppId());
|
||||
|
||||
// 根据名称模糊查询
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(sysAppRequest.getAppName()), SysApp::getAppName, sysAppRequest.getAppName());
|
||||
|
||||
// 根据编码模糊查询
|
||||
queryWrapper.like(ObjectUtil.isNotEmpty(sysAppRequest.getAppCode()), SysApp::getAppCode, sysAppRequest.getAppCode());
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue