Merge remote-tracking branch 'origin/master'

cert
schry 2 years ago
commit e668664a4f

@ -0,0 +1,89 @@
package com.glxp.api.controller.system;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.req.system.LicenseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.service.auth.SmenuService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
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 java.util.Date;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/24 11:46
* @modyified By :
*/
@RestController
public class SMenuController {
@Resource
SmenuService sysmenuService;
@GetMapping("system/license/List")
public BaseResponse getSortList(LicenseRequest licenseRequest){
List<LicenseRequest> licenseRequests = sysmenuService.selecLicentList(licenseRequest);
PageInfo<LicenseRequest> pageInfo;
pageInfo = new PageInfo<>(licenseRequests);
PageSimpleResponse<LicenseRequest> objectPageSimpleResponse = new PageSimpleResponse<>();
objectPageSimpleResponse.setTotal(pageInfo.getTotal());
objectPageSimpleResponse.setList(licenseRequests);
return ResultVOUtils.success(objectPageSimpleResponse);
}
@PostMapping("system/license/insert")
public BaseResponse insert(@RequestBody LicenseRequest licenseRequest){
Smenu authLicense = new Smenu();
BeanUtils.copyProperties(licenseRequest,authLicense);
authLicense.setId(IdUtil.getSnowflakeNextId());
boolean insert = sysmenuService.insert(authLicense);
return ResultVOUtils.success();
}
@PostMapping("system/license/delete")
public BaseResponse delete(@RequestBody LicenseRequest licenseRequest){
LicenseRequest licenseRequest1 = new LicenseRequest();
Smenu authLicense = new Smenu();
//删除接口类型 先判断下面是否有子接口
if(licenseRequest.getParentId()==0){
//判断下面是否有子接口
licenseRequest1.setParentId(licenseRequest.getId());
List<LicenseRequest> licenseRequests = sysmenuService.selecLicentList(licenseRequest1);
if(CollectionUtils.isNotEmpty(licenseRequests)){
return ResultVOUtils.error(500,"此接口类型下存在接口,不能删除!");
}
}
BeanUtils.copyProperties(licenseRequest,authLicense);
sysmenuService.delete(authLicense);
return ResultVOUtils.success();
}
@PostMapping("system/license/update")
public BaseResponse update(@RequestBody LicenseRequest licenseRequest){
Smenu authLicense = new Smenu();
BeanUtils.copyProperties(licenseRequest,authLicense);
authLicense.setUpdateTime(new Date());
sysmenuService.updateById(authLicense);
return ResultVOUtils.success();
}
}

@ -0,0 +1,111 @@
package com.glxp.api.controller.system;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.IdUtil;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dto.SysRoleMenuModel;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.entity.auth.Syrole;
import com.glxp.api.entity.auth.sroleMenu;
import com.glxp.api.req.auth.sroleRequest;
import com.glxp.api.req.system.LicenseRequest;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.auth.sroleResponse;
import com.glxp.api.service.auth.SmenuService;
import com.glxp.api.service.auth.sroleMenuService;
import com.glxp.api.service.auth.sroleService;
import org.springframework.beans.BeanUtils;
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 java.util.Date;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 14:38
* @modyified By :
*/
@RestController
public class sroleController {
@Resource
sroleService sroleService;
@Resource
SmenuService service;
@Resource
sroleMenuService sroleMenuService;
@GetMapping("system/srole/list")
public BaseResponse getRoleList(sroleRequest sroleRequest){
List<sroleResponse> sroleResponses = sroleService.selectRoleList(sroleRequest);
PageInfo<sroleResponse> pageInfo;
pageInfo = new PageInfo<>(sroleResponses);
PageSimpleResponse<sroleResponse> objectPageSimpleResponse = new PageSimpleResponse<>();
objectPageSimpleResponse.setTotal(pageInfo.getTotal());
objectPageSimpleResponse.setList(sroleResponses);
return ResultVOUtils.success(objectPageSimpleResponse);
}
@PostMapping("system/srole/insert")
public BaseResponse insertRole(@RequestBody sroleRequest sroleRequest){
Syrole syrole = new Syrole();
BeanUtils.copyProperties(sroleRequest,syrole);
syrole.setId(IdUtil.getSnowflakeNextId());
syrole.setCreateTime(new Date());
boolean insert = sroleService.insert(syrole);
return ResultVOUtils.success();
}
@PostMapping("system/srole/update")
public BaseResponse updateRole(@RequestBody sroleRequest sroleRequest){
Syrole syrole = new Syrole();
BeanUtils.copyProperties(sroleRequest,syrole);
sroleService.update(syrole);
return ResultVOUtils.success();
}
@PostMapping("system/srole/delete")
public BaseResponse deleteRole(@RequestBody sroleRequest sroleRequest){
Syrole syrole = new Syrole();
BeanUtils.copyProperties(sroleRequest,syrole);
boolean delete = sroleService.delete(syrole);
//同时删除关联表
sroleMenu sroleMenu = new sroleMenu();
sroleMenu.setRoleId(sroleRequest.getId());
sroleMenuService.delete(sroleMenu);
return ResultVOUtils.success();
}
@GetMapping("system/srole/treeselect")
public BaseResponse treeselect(Long roleId){
return ResultVOUtils.success(sroleMenuService.getRoleMenu(roleId));
}
@PostMapping("system/srole/saveRoleMenu")
public BaseResponse saveRoleMenu(@RequestBody SysRoleMenuModel model){
return sroleMenuService.saveRoleMenu(model);
}
}

@ -4,8 +4,9 @@ import com.glxp.api.entity.auth.AuthLicense;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface AuthLicenseDao {
public interface AuthLicenseDao{
AuthLicense get(String id);

@ -0,0 +1,19 @@
package com.glxp.api.dao.auth;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.req.system.LicenseRequest;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 11:07
* @modyified By :
*/
@Mapper
public interface SmenuDao extends BaseMapperPlus<SmenuDao, Smenu, Smenu> {
List<LicenseRequest> selecLicentList(LicenseRequest licenseRequest);
List<Smenu> selectActiveAll();
}

@ -0,0 +1,21 @@
package com.glxp.api.dao.auth;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.Syrole;
import com.glxp.api.req.auth.sroleRequest;
import com.glxp.api.res.auth.sroleResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 14:29
* @modyified By :
*/
@Mapper
public interface sroleDao extends BaseMapperPlus<sroleDao, Syrole,Syrole> {
List<sroleResponse> selectRoleList(sroleRequest sroleRequest);
}

@ -0,0 +1,26 @@
package com.glxp.api.dao.auth;
import com.glxp.api.dao.BaseMapperPlus;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.entity.auth.sroleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 15:57
* @modyified By :
*/
@Mapper
public interface sroleMenuDao extends BaseMapperPlus<sroleMenuDao, sroleMenu, sroleMenu> {
List<Long> selectByRoleId(@Param("roleId") Long roleId);
int deleteByRoleId(@Param("roleId") Long roleId);
int insertrm(sroleMenu sroleMenu);
}

@ -0,0 +1,43 @@
package com.glxp.api.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class MenuTreeModel {
/**
*
*/
private Long id;
/**
*
*/
private String name;
/**
* M: , C: ,F:
*/
private String type;
/**
*
*/
private String perms;
/**
*
*/
private Integer sort;
/**
* 0 1
*/
private String status;
/**
*
*/
private Date createTime;
private List<MenuTreeModel> children;
}

@ -0,0 +1,13 @@
package com.glxp.api.dto;
import lombok.Builder;
import lombok.Data;
import java.util.List;
@Data
@Builder
public class RoleMenuTreeModel {
private List<MenuTreeModel> menuTrees;
private List<Long> roleMenuIds;
}

@ -0,0 +1,11 @@
package com.glxp.api.dto;
import lombok.Data;
import java.util.List;
@Data
public class SysRoleMenuModel {
private Long roleId;
private List<Long> menuIds;
}

@ -1,11 +1,14 @@
package com.glxp.api.entity.auth;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value = "auth_license")
public class AuthLicense {
private String id;
// 名称
private String name;

@ -0,0 +1,47 @@
package com.glxp.api.entity.auth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value = "sys_menu")
public class Smenu {
@TableId(value = "id", type = IdType.INPUT)
private Long id;
// 接口分类名称
@TableField(value = "name")
private String name;
// 接口地址
@TableField(value = "path")
private String path;
@TableField(value = "parentId")
private Long parentId;
//权限标识
@TableField(value = "perms")
private String perms;
// 接口文档地址
@TableField(value = "docUrl")
private String docUrl;
// 创建时间
@TableField(value = "createTime")
private Date createTime;
// 更新时间
@TableField(value = "updateTime")
private Date updateTime;
@TableField(value = "remark")
private String remark;
}

@ -0,0 +1,37 @@
package com.glxp.api.entity.auth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
/**
* @author : zhangsan
* @date : 2023/5/25 14:19
* @modyified By :
*/
@Data
@TableName(value = "sys_role")
public class Syrole {
@TableId(value = "id", type = IdType.INPUT)
private Long id;
@TableField(value = "name")
private String name;
@TableField(value = "code")
private String code;
// 0正常 1停用
@TableField(value = "status")
private String status;
// 创建时间
@TableField(value = "createTime")
private Date createTime;
}

@ -0,0 +1,20 @@
package com.glxp.api.entity.auth;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "sys_role_menu")
public class sroleMenu {
/**
* ID
*/
private Long roleId;
/**
* ID
*/
private Long menuId;
}

@ -0,0 +1,33 @@
package com.glxp.api.req.auth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.Date;
/**
* @author : zhangsan
* @date : 2023/5/25 14:25
* @modyified By :
*/
@Data
public class sroleRequest extends ListPageRequest {
private Long id;
private String name;
private String code;
// 0正常 1停用
private String status;
// 创建时间
private Date createTime;
}

@ -0,0 +1,70 @@
package com.glxp.api.req.system;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.Date;
/**
* @author : zhangsan
* @date : 2023/5/24 11:51
* @modyified By :
*/
@Data
public class LicenseRequest extends ListPageRequest {
private Long id;
// 接口分类名称
private String name;
// 接口地址
private String path;
private Long parentId;
//权限标识
private String perms;
// 接口文档地址
private String docUrl;
// 创建时间
private Date createTime;
// 更新时间
private Date updateTime;
private String remark;
/**
*
*/
private String startTime;
/**
*
*/
private String endTime;
/**
*
*/
private String startAduditTime;
/**
*
*/
private String endAduditTime;
}

@ -0,0 +1,26 @@
package com.glxp.api.res.auth;
import lombok.Data;
import java.util.Date;
/**
* @author : zhangsan
* @date : 2023/5/25 14:26
* @modyified By :
*/
@Data
public class sroleResponse {
private Long id;
private String name;
private String code;
// 0正常 1停用
private String status;
// 创建时间
private Date createTime;
}

@ -0,0 +1,27 @@
package com.glxp.api.service.auth;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.entity.auth.SysMenu;
import com.glxp.api.req.system.LicenseRequest;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/24 11:54
* @modyified By :
*/
public interface SmenuService extends IService<Smenu> {
List<LicenseRequest> selecLicentList(LicenseRequest licenseRequest);
BaseResponse getMenuTreeActive();
boolean insert(Smenu authLicense);
boolean delete(Smenu authLicense);
}

@ -0,0 +1,84 @@
package com.glxp.api.service.auth.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.auth.SmenuDao;
import com.glxp.api.dto.MenuTreeModel;
import com.glxp.api.entity.auth.Smenu;
import com.glxp.api.entity.auth.SysMenu;
import com.glxp.api.req.system.LicenseRequest;
import com.glxp.api.service.auth.SmenuService;
import com.glxp.api.util.TreeBuildUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author : zhangsan
* @date : 2023/5/24 11:55
* @modyified By :
*/
@Service
public class SMenuServiceImpl extends ServiceImpl<SmenuDao, Smenu> implements SmenuService {
@Resource
SmenuDao smenuDao;
@Override
public List<LicenseRequest> selecLicentList(LicenseRequest licenseRequest) {
if (null == licenseRequest) {
return Collections.emptyList();
}
if (null != licenseRequest.getPage() && null != licenseRequest.getLimit()) {
PageHelper.offsetPage((licenseRequest.getPage() - 1) * licenseRequest.getLimit(), licenseRequest.getLimit());
}
return smenuDao.selecLicentList(licenseRequest);
}
@Override
public BaseResponse getMenuTreeActive() {
List<Smenu> smenus = smenuDao.selectActiveAll();
List<MenuTreeModel> child = getChild(smenus, 0l);
return ResultVOUtils.success(child);
}
@Override
public boolean insert(Smenu authLicense) {
return smenuDao.insert(authLicense)>0;
}
@Override
public boolean delete(Smenu authLicense) {
return smenuDao.deleteById(authLicense)>0;
}
private List<MenuTreeModel> getChild(List<Smenu> menus, Long pId) {
List<MenuTreeModel> result = new ArrayList<>();
List<Smenu> list = menus.stream().filter(p -> p.getParentId().equals(pId)).collect(Collectors.toList());
if (list != null && list.size() > 0) {
for (Smenu item : list) {
MenuTreeModel treeModel = new MenuTreeModel();
BeanUtils.copyProperties(item, treeModel);
List<MenuTreeModel> child = getChild(menus, treeModel.getId());
if (child != null && child.size() > 0)
treeModel.setChildren(child);
result.add(treeModel);
}
}
return result;
}
}

@ -0,0 +1,67 @@
package com.glxp.api.service.auth.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.dao.auth.sroleMenuDao;
import com.glxp.api.dto.MenuTreeModel;
import com.glxp.api.dto.RoleMenuTreeModel;
import com.glxp.api.dto.SysRoleMenuModel;
import com.glxp.api.entity.auth.sroleMenu;
import com.glxp.api.service.auth.SmenuService;
import com.glxp.api.service.auth.sroleMenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 16:06
* @modyified By :
*/
@Service
public class sroleMenuServiceImpl extends ServiceImpl<sroleMenuDao, sroleMenu> implements sroleMenuService {
@Resource
sroleMenuDao sroleMenuDao;
@Resource
SmenuService service;
@Override
public boolean delete(sroleMenu sroleMenu) {
return sroleMenuDao.delete(new QueryWrapper<sroleMenu>().eq("role_id",sroleMenu.getRoleId()))>0;
}
@Override
public boolean insert(sroleMenu sroleMenu) {
return sroleMenuDao.insert(sroleMenu)>0;
}
@Override
public BaseResponse getRoleMenu(Long roleId) {
List<MenuTreeModel> menuTree = (List<MenuTreeModel>) service.getMenuTreeActive().getData();
List<Long> longs = sroleMenuDao.selectByRoleId(roleId);
return ResultVOUtils.success(RoleMenuTreeModel.builder().menuTrees(menuTree).roleMenuIds(longs).build());
}
@Override
@Transactional(rollbackFor = Exception.class)
public BaseResponse saveRoleMenu(SysRoleMenuModel model) {
sroleMenuDao.deleteByRoleId(model.getRoleId());
for (Long menuId : model.getMenuIds()) {
sroleMenu sroleMenu = new sroleMenu();
sroleMenu.setRoleId(model.getRoleId());
sroleMenu.setMenuId(menuId);
sroleMenuDao.insertrm(sroleMenu);
}
return ResultVOUtils.success();
}
}

@ -0,0 +1,53 @@
package com.glxp.api.service.auth.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.auth.sroleDao;
import com.glxp.api.entity.auth.Syrole;
import com.glxp.api.req.auth.sroleRequest;
import com.glxp.api.res.auth.sroleResponse;
import com.glxp.api.service.auth.sroleService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 14:36
* @modyified By :
*/
@Service
public class sroleServiceImpl extends ServiceImpl<sroleDao, Syrole> implements sroleService {
@Resource
sroleDao sroleDao;
@Override
public List<sroleResponse> selectRoleList(sroleRequest sroleRequest) {
if (null == sroleRequest) {
return Collections.emptyList();
}
if (null != sroleRequest.getPage() && null != sroleRequest.getLimit()) {
PageHelper.offsetPage((sroleRequest.getPage() - 1) * sroleRequest.getLimit(), sroleRequest.getLimit());
}
return sroleDao.selectRoleList(sroleRequest);
}
@Override
public boolean insert(Syrole syrole) {
return sroleDao.insert(syrole)>0;
}
@Override
public boolean update(Syrole syrole) {
return sroleDao.updateById(syrole)>0;
}
@Override
public boolean delete(Syrole syrole) {
return sroleDao.deleteById(syrole)>0;
}
}

@ -0,0 +1,24 @@
package com.glxp.api.service.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.dto.SysRoleMenuModel;
import com.glxp.api.entity.auth.sroleMenu;
/**
* @author : zhangsan
* @date : 2023/5/25 16:05
* @modyified By :
*/
public interface sroleMenuService extends IService<sroleMenu> {
boolean delete(sroleMenu sroleMenu);
boolean insert(sroleMenu sroleMenu);
BaseResponse getRoleMenu(Long roleId);
BaseResponse saveRoleMenu(SysRoleMenuModel model);
}

@ -0,0 +1,25 @@
package com.glxp.api.service.auth;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.auth.Syrole;
import com.glxp.api.req.auth.sroleRequest;
import com.glxp.api.res.auth.sroleResponse;
import java.util.List;
/**
* @author : zhangsan
* @date : 2023/5/25 14:35
* @modyified By :
*/
public interface sroleService extends IService<Syrole> {
List<sroleResponse> selectRoleList(sroleRequest sroleRequest);
boolean insert(Syrole syrole);
boolean update(Syrole syrole);
boolean delete(Syrole syrole);
}

@ -2,6 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.glxp.api.dao.auth.AuthLicenseDao">
<select id="get" resultType="com.glxp.api.entity.auth.AuthLicense">
SELECT *
FROM auth_license
@ -51,4 +52,4 @@
</set>
where name = #{name}
</update>
</mapper>
</mapper>

@ -47,7 +47,7 @@
resultType="com.glxp.api.entity.auth.DeptEntity">
select auth_dept.* from auth_dept INNER JOIN auth_warehouse
on auth_dept.`code` =auth_warehouse.parentId
INNER JOIN auth_warehouse_user on auth_warehouse_user.`code` = auth_warehouse.code
-- INNER JOIN auth_warehouse_user on auth_warehouse_user.`code` = auth_warehouse.code
<where>
<if test="id != '' and id != null">
AND id = #{id}
@ -70,9 +70,10 @@
<if test="pcode != null">
AND pcode = #{pcode}
</if>
<if test="userId != null">
AND auth_warehouse_user.userId = #{userId}
</if>
<!-- <if test="userId != null">-->
<!-- AND auth_warehouse_user.userId = #{userId}-->
<!-- </if>-->
<if test="level != null">
AND `level` = #{level}

@ -0,0 +1,34 @@
<?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.auth.SmenuDao">
<select id="selecLicentList" parameterType="com.glxp.api.req.system.LicenseRequest"
resultType="com.glxp.api.req.system.LicenseRequest">
select *
from sys_menu
<where>
<if test="name !='' and name != null">
and name =#{name}
</if>
<if test="parentId != null">
and parentId =#{parentId}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND date_format(createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startAduditTime != null and startAduditTime != '' and endAduditTime != null and endAduditTime != ''">
AND date_format(updateTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and date_format(#{endAduditTime}, '%Y-%m-%d')
</if>
</where>
</select>
<select id="selectActiveAll" resultType="com.glxp.api.entity.auth.Smenu">
select *
from sys_menu
</select>
</mapper>

@ -0,0 +1,24 @@
<?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.auth.sroleDao">
<select id="selectRoleList" parameterType="com.glxp.api.req.auth.sroleRequest"
resultType="com.glxp.api.res.auth.sroleResponse">
select * from sys_role
<where>
<if test="name !='' and name != null">
and name = #{name}
</if>
<if test="status != '' and status != null">
and status = #{status}
</if>
</where>
</select>
</mapper>

@ -0,0 +1,28 @@
<?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.auth.sroleMenuDao">
<resultMap type="com.glxp.api.entity.auth.SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id"/>
<result property="menuId" column="menu_id"/>
</resultMap>
<select id="selectByRoleId" parameterType="java.lang.Long" resultType="java.lang.Long">
select m.id
from sys_menu m left join sys_role_menu rm on m.id = rm.menu_id
where rm.role_id = #{roleId} and m.id not in (select m.parentId from sys_menu m inner join sys_role_menu rm on m.id = rm.menu_id and rm.role_id = #{roleId})
order by m.parentId, m.id
</select>
<delete id="deleteByRoleId" parameterType="java.lang.Long">
delete
from sys_role_menu
where role_id=#{roleId}
</delete>
<insert id="insertrm" parameterType="com.glxp.api.entity.auth.Smenu">
insert into sys_role_menu (role_id, menu_id)
values (#{roleId}, #{menuId})
</insert>
</mapper>
Loading…
Cancel
Save