帮助设置
parent
4427f6cfcf
commit
e240730eaf
@ -0,0 +1,126 @@
|
||||
package com.glxp.api.controller.system;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.glxp.api.annotation.AuthRuleAnnotation;
|
||||
import com.glxp.api.common.enums.ResultEnum;
|
||||
import com.glxp.api.common.res.BaseResponse;
|
||||
import com.glxp.api.common.util.ResultVOUtils;
|
||||
import com.glxp.api.entity.auth.SysMenu;
|
||||
import com.glxp.api.entity.system.SysMenuHelpEntity;
|
||||
import com.glxp.api.req.system.SysMenuHelpRequest;
|
||||
import com.glxp.api.res.PageSimpleResponse;
|
||||
import com.glxp.api.service.auth.ISysMenuService;
|
||||
import com.glxp.api.service.system.SysMenuHelpService;
|
||||
import com.glxp.api.util.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/3/20 13:58
|
||||
* @modyified By :
|
||||
*/
|
||||
@RestController
|
||||
public class SysMenuHelpController {
|
||||
|
||||
@Resource
|
||||
private SysMenuHelpService sysMenuHelpService;
|
||||
@Resource
|
||||
private ISysMenuService iSysMenuService;
|
||||
|
||||
|
||||
|
||||
@AuthRuleAnnotation("system/param/help/list")
|
||||
@GetMapping("/system/param/help/list")
|
||||
public BaseResponse list(@Valid SysMenuHelpRequest sysMenuHelpRequest,
|
||||
BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
|
||||
List<SysMenuHelpEntity> list = sysMenuHelpService.MenuHelpList(sysMenuHelpRequest);
|
||||
PageInfo<SysMenuHelpEntity> pageInfo;
|
||||
pageInfo = new PageInfo<>(list);
|
||||
PageSimpleResponse<SysMenuHelpEntity> pageSimpleResponse = new PageSimpleResponse<>();
|
||||
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
||||
pageSimpleResponse.setList(list);
|
||||
return ResultVOUtils.success(pageSimpleResponse);
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("system/param/help/insertMenuHelp")
|
||||
@PostMapping("/system/param/help/insertMenuHelp")
|
||||
public BaseResponse insertMenuHelp(@RequestBody SysMenuHelpRequest sysMenuHelpRequest,
|
||||
BindingResult bindingResult ) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
SysMenuHelpEntity sysMenuHelpEntity = new SysMenuHelpEntity();
|
||||
BeanUtils.copyProperties(sysMenuHelpRequest,sysMenuHelpEntity);
|
||||
sysMenuHelpService.insertMenuHelp(sysMenuHelpEntity);
|
||||
return ResultVOUtils.success("成功");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("system/param/help/updateMenuHelp")
|
||||
@PostMapping("/system/param/help/updateMenuHelp")
|
||||
public BaseResponse updateMenuHelp(@RequestBody SysMenuHelpRequest sysMenuHelpRequest,
|
||||
BindingResult bindingResult ) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage());
|
||||
}
|
||||
SysMenuHelpEntity sysMenuHelpEntity = new SysMenuHelpEntity();
|
||||
BeanUtils.copyProperties(sysMenuHelpRequest,sysMenuHelpEntity);
|
||||
sysMenuHelpService.updateMenuHelp(sysMenuHelpEntity);
|
||||
return ResultVOUtils.success("成功");
|
||||
}
|
||||
|
||||
@AuthRuleAnnotation("system/param/help/deleteMenuHelp")
|
||||
@GetMapping("/system/param/help/deleteMenuHelp")
|
||||
public BaseResponse deleteMenuHelp( String id) {
|
||||
if(!StringUtils.isNotBlank(id)){
|
||||
return ResultVOUtils.error(999,"参数错误");
|
||||
}
|
||||
sysMenuHelpService.deleteMenuHelp(id);
|
||||
return ResultVOUtils.success("成功");
|
||||
}
|
||||
|
||||
|
||||
@AuthRuleAnnotation("system/param/help/selectAuthMenu")
|
||||
@GetMapping("/system/param/help/selectAuthMenu")
|
||||
|
||||
public BaseResponse selectAuthMenu( String menuName
|
||||
) {
|
||||
if(!StringUtils.isNotBlank(menuName)){
|
||||
return ResultVOUtils.error(999,"参数错误");
|
||||
}
|
||||
SysMenu sysMenu = iSysMenuService.selectMenuByName(menuName);
|
||||
SysMenuHelpRequest sysMenuHelpRequest = new SysMenuHelpRequest();
|
||||
List<SysMenuHelpEntity> list= sysMenuHelpService.MenuHelpList(sysMenuHelpRequest);
|
||||
SysMenuHelpEntity entity=null;
|
||||
for (SysMenuHelpEntity sysMenuHelpEntity : list) {
|
||||
if(sysMenuHelpEntity.getMenuKey().equals(sysMenu.getComponent())){
|
||||
entity=sysMenuHelpEntity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ResultVOUtils.success(entity);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,10 +1,16 @@
|
||||
package com.glxp.api.dao.system;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.glxp.api.entity.basic.BasicBusTypeChangeEntity;
|
||||
import com.glxp.api.entity.system.SysMenuHelpEntity;
|
||||
import com.glxp.api.req.system.SysMenuHelpRequest;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuHelpMapper extends BaseMapper<SysMenuHelpEntity> {
|
||||
|
||||
List<SysMenuHelpEntity> selectMenuHelpList(SysMenuHelpRequest sysMenuHelpRequest);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,45 @@
|
||||
package com.glxp.api.req.system;
|
||||
|
||||
import com.glxp.api.util.page.ListPageRequest;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/3/20 14:03
|
||||
* @modyified By :
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SysMenuHelpRequest extends ListPageRequest {
|
||||
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String menuKey;
|
||||
|
||||
private String menuName;
|
||||
|
||||
private Byte status;
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String remark;
|
||||
|
||||
private String updateTime;
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_MENUKEY = "menuKey";
|
||||
|
||||
public static final String COL_MENUNAME = "menuName";
|
||||
|
||||
public static final String COL_STATUS = "status";
|
||||
|
||||
public static final String COL_FILEPATH = "filePath";
|
||||
|
||||
public static final String COL_REMARK = "remark";
|
||||
|
||||
public static final String COL_UPDATETIME = "updateTime";
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.glxp.api.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author : zhangsan
|
||||
* @date : 2023/3/20 14:23
|
||||
* @modyified By :
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuHelpResponse {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String menuKey;
|
||||
|
||||
private String menuName;
|
||||
|
||||
private Byte status;
|
||||
|
||||
private String filePath;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_MENUKEY = "menuKey";
|
||||
|
||||
public static final String COL_MENUNAME = "menuName";
|
||||
|
||||
public static final String COL_STATUS = "status";
|
||||
|
||||
public static final String COL_FILEPATH = "filePath";
|
||||
|
||||
public static final String COL_REMARK = "remark";
|
||||
|
||||
public static final String COL_UPDATETIME = "updateTime";
|
||||
}
|
@ -1,9 +1,24 @@
|
||||
package com.glxp.api.service.system;
|
||||
|
||||
import com.glxp.api.entity.inout.IoOrderInvoiceEntity;
|
||||
import com.glxp.api.entity.monitor.SysOperLog;
|
||||
import com.glxp.api.entity.system.SysMenuHelpEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.glxp.api.req.system.SysMenuHelpRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMenuHelpService {
|
||||
|
||||
List<SysMenuHelpEntity> MenuHelpList(SysMenuHelpRequest sysMenuHelpRequest);
|
||||
|
||||
boolean insertMenuHelp(SysMenuHelpEntity sysMenuHelpEntity);
|
||||
|
||||
boolean updateMenuHelp(SysMenuHelpEntity sysMenuHelpEntity);
|
||||
|
||||
boolean deleteMenuHelp(String id);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,12 +1,44 @@
|
||||
package com.glxp.api.service.system.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.glxp.api.dao.monitor.SysOperLogMapper;
|
||||
import com.glxp.api.req.system.SysMenuHelpRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.glxp.api.dao.system.SysMenuHelpMapper;
|
||||
import com.glxp.api.entity.system.SysMenuHelpEntity;
|
||||
import com.glxp.api.service.system.SysMenuHelpService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysMenuHelpServiceImpl implements SysMenuHelpService {
|
||||
|
||||
@Resource
|
||||
private SysMenuHelpMapper sysMenuHelpMapper;
|
||||
|
||||
@Override
|
||||
public List<SysMenuHelpEntity> MenuHelpList(SysMenuHelpRequest sysMenuHelpRequest) {
|
||||
if (sysMenuHelpRequest.getPage() != null) {
|
||||
int offset = (sysMenuHelpRequest.getPage() - 1) * sysMenuHelpRequest.getLimit();
|
||||
PageHelper.offsetPage(offset, sysMenuHelpRequest.getLimit());
|
||||
}
|
||||
return sysMenuHelpMapper.selectMenuHelpList(sysMenuHelpRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertMenuHelp(SysMenuHelpEntity sysMenuHelpEntity) {
|
||||
return sysMenuHelpMapper.insert(sysMenuHelpEntity)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMenuHelp(SysMenuHelpEntity sysMenuHelpEntity) {
|
||||
return sysMenuHelpMapper.updateById(sysMenuHelpEntity)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMenuHelp(String id) {
|
||||
return sysMenuHelpMapper.deleteById(id)>0;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.glxp.api.dao.system.SysMenuHelpMapper">
|
||||
<select id="selectMenuHelpList"
|
||||
parameterType="com.glxp.api.req.system.SysMenuHelpRequest"
|
||||
resultType="com.glxp.api.entity.system.SysMenuHelpEntity">
|
||||
select * from sys_menu_help
|
||||
<where>
|
||||
<if test="id != null">
|
||||
AND id = #{id}
|
||||
</if>
|
||||
<if test="menuKey != null and menuKey != ''">
|
||||
AND menuKey like concat('%',#{menuKey},'%')
|
||||
</if>
|
||||
<if test="menuName != null and menuName != ''">
|
||||
AND menuName like concat('%',#{menuName},'%')
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status= #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue