提交 04e6346d 作者: zhenjie

Merge branch 'develop'

......@@ -29,5 +29,7 @@ public class RoleInfoDTO implements Serializable {
private String remark;
@ApiModelProperty(value = "账号名称/创建人")
private String userName;
@ApiModelProperty(value = "0不是超级管理员 1是超级管理员")
private Integer superAdmin;
}
......@@ -30,10 +30,16 @@ public class CodeUtil {
return "DELETE" + CodeUtil.getRandomNum(15);
}
public static String createRoleNo() {
StringBuffer sb = new StringBuffer();
sb.append("A");
sb.append(CodeUtil.getRandomNum(4));
return sb.toString();
public static String createRoleNo(String roleNo) {
return getNewEquipmentNo("A", roleNo);
}
public static String getNewEquipmentNo(String equipmentType, String equipmentNo) {
String newEquipmentNo = "A" + "0001";
if (equipmentNo != null && !equipmentNo.isEmpty()) {
int newEquipment = Integer.parseInt(equipmentNo.substring(1)) + 1;
newEquipmentNo = String.format(equipmentType + "%04d", newEquipment);
}
return newEquipmentNo;
}
}
......@@ -2,16 +2,15 @@ package com.mmc.iuav.user.controller;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.MenuInfoDTO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
import com.mmc.iuav.user.service.MenuInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author: zj
......@@ -31,17 +30,4 @@ public class MenuInfoController extends BaseController {
return menuInfoService.listMenuInfo();
}
@ApiOperation(value = "根据角色id获取权限")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MenuInfoDTO.class)})
@GetMapping("listRoleMenuInfo")
public ResultBody listRoleMenuInfo(@RequestParam Integer roleId) {
return menuInfoService.listRoleMenuInfo(roleId);
}
@ApiOperation(value = "修改角色菜单权限")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("updateRoleMenuInfo")
public ResultBody updateRoleMenuInfo(HttpServletRequest request, @RequestBody RoleMenuInfoVO roleMenuInfoVO) {
return menuInfoService.updateRoleMenuInfo(roleMenuInfoVO, this.getUserLoginInfoFromRedis(request));
}
}
......@@ -4,9 +4,11 @@ import com.mmc.iuav.group.Create;
import com.mmc.iuav.group.Page;
import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.MenuInfoDTO;
import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
import com.mmc.iuav.user.service.RoleService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -60,12 +62,19 @@ public class RoleController extends BaseController {
return ResultBody.success(roleService.listPageRoleInfo(param, this.getUserLoginInfoFromRedis(request)));
}
@ApiOperation(value = "根据角色id获取权限")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = MenuInfoDTO.class)})
@GetMapping("listRoleMenuInfo")
public ResultBody listRoleMenuInfo(@RequestParam Integer roleId) {
return roleService.listRoleMenuInfo(roleId);
}
@ApiOperation(value = "角色管理-当前角色绑定了那些账号")
@ApiOperation(value = "修改角色菜单权限")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("roleAccountList")
public ResultBody<RoleInfoDTO> roleAccountList(@ApiParam(value = "角色id", required = true) @RequestParam Integer id) {
return roleService.roleAccountList(id);
@PostMapping("updateRoleMenuInfo")
public ResultBody updateRoleMenuInfo(HttpServletRequest request, @RequestBody RoleMenuInfoVO roleMenuInfoVO) {
return roleService.updateRoleMenuInfo(roleMenuInfoVO, this.getUserLoginInfoFromRedis(request));
}
}
......@@ -4,7 +4,6 @@ import com.mmc.iuav.group.Page;
import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.service.UserAccountService;
......@@ -23,86 +22,86 @@ import java.util.List;
@Api(tags = "小程序用户账号相关接口")
@RequestMapping("/user-account/")
@RestController
public class UserAccountController extends BaseController{
public class UserAccountController extends BaseController {
@Autowired
private UserAccountService userAccountService;
@ApiOperation(value = "客户列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountVO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountVO.class)})
@PostMapping("listAppUser")
public ResultBody<UserAccountVO> listAppUser(@Validated(value = {Page.class})@RequestBody UserAccountQO userAccountQO){
public ResultBody<UserAccountVO> listAppUser(@Validated(value = {Page.class}) @RequestBody UserAccountQO userAccountQO) {
return userAccountService.listAppUser(userAccountQO);
}
@ApiOperation(value = "获取用户信息")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountVO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountVO.class)})
@GetMapping("info")
public ResultBody info(HttpServletRequest request) {
return ResultBody.success(userAccountService.getUserAccountById(this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "修改用户信息")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("update")
public ResultBody update(@Validated(value = {Update.class})@RequestBody UserAccountVO userAccountVO){
public ResultBody update(@Validated(value = {Update.class}) @RequestBody UserAccountVO userAccountVO) {
return userAccountService.update(userAccountVO);
}
@ApiOperation(value = "获取用户基本信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignGetUserSimpleInfo")
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId){
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId) {
return userAccountService.getUserSimpleInfo(userAccountId);
}
@ApiOperation(value = "根据用户地区查询后台用户id", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignListUserAccountIds")
public List<Integer>feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode, @RequestParam(required = false) Integer districtCode){
public List<Integer> feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode, @RequestParam(required = false) Integer districtCode) {
return userAccountService.feignListUserAccountIds(provinceCode, cityCode, districtCode);
}
@ApiOperation(value = "授权手机号")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = Integer.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("getUserPhoneNumber")
public ResultBody getUserPhoneNumber(HttpServletRequest request,
@ApiParam(value = "授权手机号code", required = true) @RequestParam String code) {
@ApiParam(value = "授权手机号code", required = true) @RequestParam String code) {
return userAccountService.getUserPhoneNumber(this.getUserLoginInfoFromRedis(request).getUserAccountId(), code);
}
@ApiOperation(value = "根据用户id查询用户信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListUserAccountByIds")
public List<UserAccountSimpleDTO> feignListUserAccountByIds(@RequestBody List<Integer> ids){
public List<UserAccountSimpleDTO> feignListUserAccountByIds(@RequestBody List<Integer> ids) {
return userAccountService.feignListUserAccountByIds(ids);
}
@ApiOperation(value = "根据条件查询用户信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListAppUserAccount")
public List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO) {
public List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO) {
return userAccountService.feignListUserAccount(userAccountQO);
}
@ApiOperation(value = "根据用户ids上级推荐人信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListRcdUserInfo")
public List<UserAccountSimpleDTO> feignListRcdUserInfo(@RequestBody List<Integer> userIds){
public List<UserAccountSimpleDTO> feignListRcdUserInfo(@RequestBody List<Integer> userIds) {
return userAccountService.feignListRcdUserInfo(userIds);
}
@ApiOperation(value = "查询上级推荐人id", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = Integer.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("feignGetSuperiorRef")
public Integer feignGetSuperiorRef(@RequestParam Integer userAccountId){
public Integer feignGetSuperiorRef(@RequestParam Integer userAccountId) {
return userAccountService.feignGetSuperiorRef(userAccountId);
}
@ApiOperation(value = "查询上级推荐人信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignGetUserRcdInfo")
public UserAccountSimpleDTO feignGetUserRcdInfo(@RequestParam Integer userAccountId){
public UserAccountSimpleDTO feignGetUserRcdInfo(@RequestParam Integer userAccountId) {
return userAccountService.feignGetUserRcdInfo(userAccountId);
}
......@@ -113,6 +112,4 @@ public class UserAccountController extends BaseController{
return userAccountService.removeAppAccount(userAccountId);
}
}
......@@ -2,7 +2,6 @@ package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.MenuInfoDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -12,11 +11,7 @@ import java.util.List;
*/
@Mapper
public interface MenuInfoDao {
List<MenuInfoDO> listMenuInfo();
List<MenuInfoDO> listRoleMenuInfo(Integer roleId);
void batchAddMenuIds(Integer roleId, @Param("addMenuIds") List<Integer> addMenuIds);
List<MenuInfoDO> listMenuInfo();
void batchDeleteMenuIds(Integer roleId, @Param("deleteMenuIds") List<Integer> deleteMenuIds);
}
package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.MenuInfoDO;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import org.apache.ibatis.annotations.Mapper;
......@@ -35,7 +35,12 @@ public interface RoleDao {
Integer countNotDelUserAccountByRole(Integer id);
List<UserAccountDO> roleAccountList(Integer id);
String findList();
List<MenuInfoDO> listRoleMenuInfo(Integer roleId);
void batchAddMenuIds(Integer roleId, List<Integer> addMenuIds);
void batchDeleteMenuIds(Integer roleId, List<Integer> deleteMenuIds);
}
......@@ -17,6 +17,7 @@ import java.util.List;
public interface UserServiceDao {
/**
* 根据用户unionId查询用户信息
*
* @param unionId
* @return
*/
......@@ -24,12 +25,14 @@ public interface UserServiceDao {
/**
* 插入用户信息
*
* @param userAccountDO
*/
void insertUserAccount(UserAccountDO userAccountDO);
/**
* 根据用户id查询用户信息
*
* @param userAccountId
* @return
*/
......@@ -37,12 +40,14 @@ public interface UserServiceDao {
/**
* 修改用户信息
*
* @param userAccountDO
*/
void update(UserAccountDO userAccountDO);
/**
* 根据用户地区查询后台用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
......@@ -52,6 +57,7 @@ public interface UserServiceDao {
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
......@@ -60,6 +66,7 @@ public interface UserServiceDao {
/**
* 批量获取用户信息
*
* @param userAccountQO
* @return
*/
......@@ -67,6 +74,7 @@ public interface UserServiceDao {
/**
* 删除用户
*
* @param removeNO
* @param userAccountId
*/
......@@ -74,6 +82,7 @@ public interface UserServiceDao {
/**
* 根据账号名称查询数量
*
* @param excludeId
* @param accountNo
* @return
......@@ -82,6 +91,7 @@ public interface UserServiceDao {
/**
* 查询用户数量
*
* @param param
* @return
*/
......@@ -89,6 +99,7 @@ public interface UserServiceDao {
/**
* 查询用户信息
*
* @param param
* @return
*/
......@@ -96,6 +107,7 @@ public interface UserServiceDao {
/**
* 修改用户密码
*
* @param id
* @param passWord
*/
......@@ -103,6 +115,7 @@ public interface UserServiceDao {
/**
* 获取用户密码
*
* @param id
* @return
*/
......@@ -110,13 +123,15 @@ public interface UserServiceDao {
/**
* 根据id查询用户信息
*
* @param userIds
* @return
*/
List<UserAccountDO> listUserAccountByIds(@Param("userIds")List<Integer> userIds);
List<UserAccountDO> listUserAccountByIds(@Param("userIds") List<Integer> userIds);
/**
* 获取用户推荐人信息
*
* @param userIds
* @return
*/
......@@ -124,6 +139,7 @@ public interface UserServiceDao {
/**
* 获取推荐人信息
*
* @param userAccountId
* @return
*/
......@@ -131,6 +147,7 @@ public interface UserServiceDao {
/**
* 获取用户推荐信息
*
* @param userAccountId
* @return
*/
......@@ -138,6 +155,7 @@ public interface UserServiceDao {
/**
* 用户数量
*
* @param param
* @return
*/
......@@ -145,8 +163,10 @@ public interface UserServiceDao {
/**
* 用户信息
*
* @param param
* @return
*/
List<UserAccountDO> listAppUser(UserAccountQO param);
}
......@@ -18,14 +18,37 @@ import java.util.Date;
public class MenuInfoDO implements Serializable {
private static final long serialVersionUID = -4992870152816350664L;
private Integer id;
/**
* 父级id
*/
private Integer pid;
/**
* 菜单名
*/
private String menuName;
private String portType;
/**
* 菜单类型:0菜单,1按钮
*/
private String domType;
/**
* 菜单路径
*/
private String pathInfo;
/**
* 菜单图标
*/
private String icon;
/**
* 序号
*/
private Integer sort;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
public MenuInfoDTO buildMenuInfoDTO() {
......
package com.mmc.iuav.user.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import lombok.AllArgsConstructor;
......@@ -8,6 +9,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @Author small
......@@ -41,13 +43,15 @@ public class RoleInfoDO {
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 账号id
* 创建角色账号id
*/
private Integer userAccountId;
/**
......@@ -55,6 +59,21 @@ public class RoleInfoDO {
*/
private String userName;
/**
* 角色关联账号表
*/
List<UserRoleRel> userRoleRelList;
/**
* 角色关联菜单
*/
List<MenuInfoDO> menuInfoDOList;
/**
* 0不是超级管理员 1是超级管理员
*/
private Integer superAdmin;
/**
* DTO转换
......@@ -64,6 +83,7 @@ public class RoleInfoDO {
public RoleInfoDTO buildRoleInfoDTO() {
return RoleInfoDTO.builder().id(this.id).roleNo(this.roleNo).roleName(this.roleName)
.userName(this.userName)
.superAdmin(this.superAdmin)
.remark(this.remark).build();
}
......
package com.mmc.iuav.user.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author small
* @Date 2023/7/12 13:29
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserRoleRel {
/**
* 角色与账号关联表id
*/
private Integer id;
/**
* 账号关联角色id
*/
private Integer userAccountId;
/**
* 角色id
*/
private Integer roleId;
/**
* 角色与账号关联表id
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
package com.mmc.iuav.user.service;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
/**
* @author: zj
* @Date: 2023/7/11 14:13
*/
public interface MenuInfoService {
ResultBody updateRoleMenuInfo(RoleMenuInfoVO roleMenuInfoVO, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody listMenuInfo();
ResultBody listRoleMenuInfo(Integer roleId);
}
......@@ -5,6 +5,7 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
/**
......@@ -21,5 +22,7 @@ public interface RoleService {
PageResult listPageRoleInfo(RoleInfoQO param, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody roleAccountList(Integer id);
ResultBody listRoleMenuInfo(Integer roleId);
ResultBody updateRoleMenuInfo(RoleMenuInfoVO roleMenuInfoVO, LoginSuccessDTO userLoginInfoFromRedis);
}
......@@ -4,7 +4,6 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.LoginUserQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
......@@ -18,6 +17,7 @@ import java.util.List;
public interface UserAccountService {
/**
* Get the user account
*
* @param unionId
* @return
*/
......@@ -25,12 +25,14 @@ public interface UserAccountService {
/**
* Insert the user account
*
* @param userAccountDO
*/
void insertUserAccount(UserAccountDO userAccountDO);
/**
* 通过用户id获取用户信息
*
* @param userAccountId
* @return
*/
......@@ -38,6 +40,7 @@ public interface UserAccountService {
/**
* 修改用户信息
*
* @param userAccountVO
* @return
*/
......@@ -45,6 +48,7 @@ public interface UserAccountService {
/**
* 获取用户基本信息
*
* @param userAccountId
* @return
*/
......@@ -52,6 +56,7 @@ public interface UserAccountService {
/**
* 根据用户地区查询后台用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
......@@ -61,6 +66,7 @@ public interface UserAccountService {
/**
* 添加后台用户
*
* @param bUserAccountVO
* @return
*/
......@@ -68,6 +74,7 @@ public interface UserAccountService {
/**
* 删除用户信
*
* @param userAccountId
* @return
*/
......@@ -75,6 +82,7 @@ public interface UserAccountService {
/**
* 后台用户列表
*
* @param bUserAccountQO
* @return
*/
......@@ -82,6 +90,7 @@ public interface UserAccountService {
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
......@@ -90,6 +99,7 @@ public interface UserAccountService {
/**
* 内部获取用户列表
*
* @param userAccountQO
* @return
*/
......@@ -97,6 +107,7 @@ public interface UserAccountService {
/**
* 修改用户信息
*
* @param bUserAccountVO
* @return
*/
......@@ -104,6 +115,7 @@ public interface UserAccountService {
/**
* 修改用户密码
*
* @param account
* @return
*/
......@@ -111,6 +123,7 @@ public interface UserAccountService {
/**
* 验证用户密码
*
* @param id
* @param authPwd
* @return
......@@ -119,6 +132,7 @@ public interface UserAccountService {
/**
* 授权手机号
*
* @param id
* @param code
* @return
......@@ -127,6 +141,7 @@ public interface UserAccountService {
/**
* 根据id获取用户信息
*
* @param ids
* @return
*/
......@@ -134,6 +149,7 @@ public interface UserAccountService {
/**
* 根据用户id获取推荐人信息
*
* @param userIds
* @return
*/
......@@ -141,6 +157,7 @@ public interface UserAccountService {
/**
* 获取推荐人id
*
* @param userAccountId
* @return
*/
......@@ -148,6 +165,7 @@ public interface UserAccountService {
/**
* 获取推荐人信息
*
* @param userAccountId
* @return
*/
......@@ -155,6 +173,7 @@ public interface UserAccountService {
/**
* 用户列表
*
* @param userAccountQO
* @return
*/
......@@ -162,8 +181,11 @@ public interface UserAccountService {
/**
* 删除小程序用户
*
* @param userAccountId
* @return
*/
ResultBody removeAppAccount(Integer userAccountId);
}
......@@ -2,18 +2,12 @@ package com.mmc.iuav.user.service.impl;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.dao.MenuInfoDao;
import com.mmc.iuav.user.dao.RoleDao;
import com.mmc.iuav.user.entity.MenuInfoDO;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.MenuInfoDTO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
import com.mmc.iuav.user.service.MenuInfoService;
import com.mmc.iuav.user.util.MenuTreeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
......@@ -27,31 +21,6 @@ public class MenuInfoServiceImpl implements MenuInfoService {
@Autowired
private MenuInfoDao menuInfoDao;
@Autowired
private RoleDao roleDao;
@Transactional
@Override
public ResultBody updateRoleMenuInfo(RoleMenuInfoVO roleMenuInfoVO, LoginSuccessDTO loginSuccessDTO) {
// 判断该角色的菜单是否可以修改
RoleInfoDO roleInfo = roleDao.getRoleInfo(roleMenuInfoVO.getRoleId());
if (!CollectionUtils.isEmpty(roleMenuInfoVO.getMenuInfoIds())) {
List<MenuInfoDO> menuInfoDOList = menuInfoDao.listRoleMenuInfo(roleMenuInfoVO.getRoleId());
List<Integer> existMenuIds = menuInfoDOList.stream().map(MenuInfoDO::getId).collect(Collectors.toList());
// 新添加的权限
List<Integer> addMenuIds = roleMenuInfoVO.getMenuInfoIds().stream().filter(v -> !existMenuIds.contains(v)).collect(Collectors.toList());
// 需删除的权限
List<Integer> deleteMenuIds = existMenuIds.stream().filter(v -> !roleMenuInfoVO.getMenuInfoIds().contains(v)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(addMenuIds)) {
menuInfoDao.batchAddMenuIds(roleMenuInfoVO.getRoleId(), addMenuIds);
}
if (!CollectionUtils.isEmpty(deleteMenuIds)) {
menuInfoDao.batchDeleteMenuIds(roleMenuInfoVO.getRoleId(), deleteMenuIds);
}
}
return ResultBody.success();
}
@Override
public ResultBody listMenuInfo() {
List<MenuInfoDO> menuInfoDOList = menuInfoDao.listMenuInfo();
......@@ -59,10 +28,4 @@ public class MenuInfoServiceImpl implements MenuInfoService {
return ResultBody.success(MenuTreeUtil.buildTreePCMenu(menuInfoDTOS));
}
@Override
public ResultBody listRoleMenuInfo(Integer roleId) {
List<MenuInfoDO> menuInfoDOList = menuInfoDao.listRoleMenuInfo(roleId);
List<MenuInfoDTO> menuInfoDTOS = menuInfoDOList.stream().map(MenuInfoDO::buildMenuInfoDTO).collect(Collectors.toList());
return ResultBody.success(MenuTreeUtil.buildTreePCMenu(menuInfoDTOS));
}
}
......@@ -5,15 +5,18 @@ import com.mmc.iuav.page.PageResult;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.dao.RoleDao;
import com.mmc.iuav.user.entity.MenuInfoDO;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.dto.MenuInfoDTO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import com.mmc.iuav.user.model.vo.RoleMenuInfoVO;
import com.mmc.iuav.user.service.RoleService;
import com.mmc.iuav.user.util.MenuTreeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
......@@ -38,7 +41,7 @@ public class RoleServiceImpl implements RoleService {
}
RoleInfoDO rd = new RoleInfoDO(roleInfo);
rd.setUserAccountId(userLoginInfoFromRedis.getUserAccountId());
rd.setRoleNo(CodeUtil.createRoleNo());
rd.setRoleNo(CodeUtil.createRoleNo(roleDao.findList()));
roleDao.insertRoleInfo(rd);
return ResultBody.success();
}
......@@ -80,11 +83,30 @@ public class RoleServiceImpl implements RoleService {
}
@Override
public ResultBody roleAccountList(Integer id) {
List<UserAccountDO> roleInfoDOS = roleDao.roleAccountList(id);
List<UserAccountSimpleDTO> accountSimpleDTOS = roleInfoDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
return ResultBody.success(accountSimpleDTOS);
public ResultBody listRoleMenuInfo(Integer roleId) {
List<MenuInfoDO> menuInfoDOList = roleDao.listRoleMenuInfo(roleId);
List<MenuInfoDTO> menuInfoDTOS = menuInfoDOList.stream().map(MenuInfoDO::buildMenuInfoDTO).collect(Collectors.toList());
return ResultBody.success(MenuTreeUtil.buildTreePCMenu(menuInfoDTOS));
}
@Override
public ResultBody updateRoleMenuInfo(RoleMenuInfoVO roleMenuInfoVO, LoginSuccessDTO userLoginInfoFromRedis) {
// 判断该角色的菜单是否可以修改
if (!CollectionUtils.isEmpty(roleMenuInfoVO.getMenuInfoIds())) {
List<MenuInfoDO> menuInfoDOList = roleDao.listRoleMenuInfo(roleMenuInfoVO.getRoleId());
List<Integer> existMenuIds = menuInfoDOList.stream().map(MenuInfoDO::getId).collect(Collectors.toList());
// 新添加的权限
List<Integer> addMenuIds = roleMenuInfoVO.getMenuInfoIds().stream().filter(v -> !existMenuIds.contains(v)).collect(Collectors.toList());
// 需删除的权限
List<Integer> deleteMenuIds = existMenuIds.stream().filter(v -> !roleMenuInfoVO.getMenuInfoIds().contains(v)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(addMenuIds)) {
roleDao.batchAddMenuIds(roleMenuInfoVO.getRoleId(), addMenuIds);
}
if (!CollectionUtils.isEmpty(deleteMenuIds)) {
roleDao.batchDeleteMenuIds(roleMenuInfoVO.getRoleId(), deleteMenuIds);
}
}
return ResultBody.success();
}
}
......@@ -13,7 +13,10 @@ import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.*;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import com.mmc.iuav.user.model.vo.CooperationTagVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.mq.MqProducer;
import com.mmc.iuav.user.service.CompanyAuthService;
import com.mmc.iuav.user.service.UserAccountService;
......@@ -74,7 +77,7 @@ public class UserAccountServiceImpl implements UserAccountService {
CompanyAuthVO companyAuthVO = companyAuthService.getCompanyAuthByUId(userAccountId);
if (companyAuthVO != null) {
userAccountVO.setCompanyAuthStatus(companyAuthVO.getAuthStatus());
}else {
} else {
userAccountVO.setCompanyAuthStatus(0);
}
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
......@@ -96,18 +99,18 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public UserAccountSimpleDTO getUserSimpleInfo(Integer userAccountId) {
UserAccountDO userAccountDO = userServiceDao.getUserAccountById(userAccountId);
if (userAccountDO == null){
if (userAccountDO == null) {
return null;
}
UserAccountSimpleDTO userAccountSimpleDTO = userAccountDO.buildUserAccountSimpleDTO();
CompanyAuthVO companyAuthVO = companyAuthService.getCompanyAuthByUId(userAccountId);
if (companyAuthVO != null) {
userAccountSimpleDTO.setCompanyAuthStatus(companyAuthVO.getAuthStatus());
}else {
} else {
userAccountSimpleDTO.setCompanyAuthStatus(0);
}
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
List<CooperationTagVO> cooperationTags = cooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountSimpleDTO.setCooperationTagVOS(cooperationTags);
}
......@@ -184,15 +187,15 @@ public class UserAccountServiceImpl implements UserAccountService {
return accountSimpleDTOS;
}
public void buildCooperationTagVO(List<UserAccountSimpleDTO> accountSimpleDTOS){
public void buildCooperationTagVO(List<UserAccountSimpleDTO> accountSimpleDTOS) {
List<Integer> uIds = accountSimpleDTOS.stream().map(UserAccountSimpleDTO::getId).collect(Collectors.toList());
//设置用户的渠道等级
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTagByUIds(uIds);
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
Map<Integer, List<CooperationTagDO>> userTagsMap = cooperationTagDOS.stream().collect(Collectors.groupingBy(CooperationTagDO::getUserAccountId));
for (UserAccountSimpleDTO simpleDTO : accountSimpleDTOS) {
List<CooperationTagDO> tagDOS = userTagsMap.get(simpleDTO.getId());
if (!CollectionUtils.isEmpty(tagDOS)){
if (!CollectionUtils.isEmpty(tagDOS)) {
List<CooperationTagVO> cooperationTagVOS = tagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
simpleDTO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -253,7 +256,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public ResultBody getUserPhoneNumber(Integer id, String code) {
String userPhoneNumber = wxService.getUserPhoneNumber(id, code);
if (StringUtils.isBlank(userPhoneNumber)){
if (StringUtils.isBlank(userPhoneNumber)) {
return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR);
}
UserAccountDO userAccount = new UserAccountDO();
......@@ -266,7 +269,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public List<UserAccountSimpleDTO> feignListUserAccountByIds(List<Integer> ids) {
List<UserAccountDO> userAccountDOS = userServiceDao.listUserAccountByIds(ids);
if (!CollectionUtils.isEmpty(userAccountDOS)){
if (!CollectionUtils.isEmpty(userAccountDOS)) {
List<UserAccountSimpleDTO> userAccountSimpleDTOS = userAccountDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
//设置用户的渠道等级
buildCooperationTagVO(userAccountSimpleDTOS);
......@@ -278,7 +281,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public List<UserAccountSimpleDTO> feignListRcdUserInfo(List<Integer> userIds) {
List<UserAccountDO> userAccountDOS = userServiceDao.feignListRcdUserInfo(userIds);
if (!CollectionUtils.isEmpty(userAccountDOS)){
if (!CollectionUtils.isEmpty(userAccountDOS)) {
List<UserAccountSimpleDTO> userAccountSimpleDTOS = userAccountDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
//设置用户的渠道等级
buildCooperationTagVO(userAccountSimpleDTOS);
......@@ -290,7 +293,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public Integer feignGetSuperiorRef(Integer userAccountId) {
UserRcdDO userRcdDO = userServiceDao.getUserRcdDO(userAccountId);
if (userRcdDO != null){
if (userRcdDO != null) {
return userRcdDO.getId();
}
return null;
......@@ -299,10 +302,10 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public UserAccountSimpleDTO feignGetUserRcdInfo(Integer userAccountId) {
UserAccountDO rcdAccountDO = userServiceDao.getUserRcdByAccountId(userAccountId);
if (rcdAccountDO != null){
if (rcdAccountDO != null) {
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
UserAccountSimpleDTO userAccountSimpleDTO = rcdAccountDO.buildUserAccountSimpleDTO();
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
List<CooperationTagVO> cooperationTagVOS = cooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountSimpleDTO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -314,7 +317,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public ResultBody listAppUser(UserAccountQO param) {
int count = userServiceDao.countListAppUser(param);
if (count == 0){
if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
......@@ -327,7 +330,7 @@ public class UserAccountServiceImpl implements UserAccountService {
List<UserAccountVO> userAccountVOS = res.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList());
for (UserAccountVO userAccountVO : userAccountVOS) {
List<CooperationTagDO> userCooperationTagDOS = userTagsMap.get(userAccountVO.getId());
if (!CollectionUtils.isEmpty(userCooperationTagDOS)){
if (!CollectionUtils.isEmpty(userCooperationTagDOS)) {
List<CooperationTagVO> cooperationTagVOS = userCooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountVO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -350,7 +353,7 @@ public class UserAccountServiceImpl implements UserAccountService {
Map<Integer, CooperationTagDO> cooperationTagDOMap = cooperationTagDOS.stream().collect(Collectors.toMap(CooperationTagDO::getId, d -> d, (k1, k2) -> k2));
for (UserAccountDO userAccountDO : userAccountDOList) {
CooperationTagDO cooperationTagDO = cooperationTagDOMap.get(userAccountDO.getCooperationTagId());
if (cooperationTagDO != null){
if (cooperationTagDO != null) {
userAccountDO.setTagName(cooperationTagDO.getTagName());
}
}
......
......@@ -9,8 +9,8 @@ import java.util.List;
* @author zj
*/
public class MenuTreeUtil {
public final static Integer SXTB_PC_MENU_PID = 1;
public final static String SXTB_PC_MENU_NAME = "云享飞管理后台";
public final static Integer IUAV_PC_MENU_PID = 1;
public final static String IUAV_PC_MENU_NAME = "云享飞管理后台";
public static void builderTree(List<MenuInfoDTO> treeEntityList, MenuInfoDTO pTreeEntity) {
List<MenuInfoDTO> childMenus = new ArrayList<MenuInfoDTO>();
......@@ -46,8 +46,8 @@ public class MenuTreeUtil {
*/
public static MenuInfoDTO buildTreePCMenu(List<MenuInfoDTO> treeEntityList) {
MenuInfoDTO parent = new MenuInfoDTO();
parent.setId(MenuTreeUtil.SXTB_PC_MENU_PID);
parent.setMenuName(SXTB_PC_MENU_NAME);
parent.setId(MenuTreeUtil.IUAV_PC_MENU_PID);
parent.setMenuName(IUAV_PC_MENU_NAME);
MenuTreeUtil.builderTree(treeEntityList, parent);
return parent;
}
......
......@@ -21,9 +21,12 @@
<result property="updateTime" column="update_time"/>
</resultMap>
<insert id="insertBackUserAccount" parameterType="com.mmc.iuav.user.entity.BackUserAccountDO" keyProperty="id" useGeneratedKeys="true">
insert into back_user_account( account_no, pass_word, phone_num, user_name, user_sex, email, province_code, city_code, district_code, address, remark, create_time)
values(#{accountNo}, #{password}, #{phoneNum}, #{userName}, #{userSex}, #{email}, #{provinceCode}, #{cityCode}, #{districtCode}, #{address}, #{remark}, NOW())
<insert id="insertBackUserAccount" parameterType="com.mmc.iuav.user.entity.BackUserAccountDO" keyProperty="id"
useGeneratedKeys="true">
insert into back_user_account(account_no, pass_word, phone_num, user_name, user_sex, email, province_code,
city_code, district_code, address, remark, create_time)
values (#{accountNo}, #{password}, #{phoneNum}, #{userName}, #{userSex}, #{email}, #{provinceCode}, #{cityCode},
#{districtCode}, #{address}, #{remark}, NOW())
</insert>
<update id="updateBackUserAccount">
......@@ -69,64 +72,111 @@
</update>
<update id="removeBackUserAccountDO">
update back_user_account set is_deleted = 1 where is_deleted = 0 and id = #{id}
update back_user_account
set is_deleted = 1
where is_deleted = 0
and id = #{id}
</update>
<update id="updatePassword">
update back_user_account set pass_word = #{passWord} where id = #{id}
update back_user_account
set pass_word = #{passWord}
where id = #{id}
</update>
<select id="getBackUserAccountDO" resultType="com.mmc.iuav.user.entity.BackUserAccountDO">
select id, account_no, phone_num, user_name, user_sex, email, account_status, remark, province_code, city_code, district_code, address, is_deleted, create_time, update_time
select id,
account_no,
phone_num,
user_name,
user_sex,
email,
account_status,
remark,
province_code,
city_code,
district_code,
address,
is_deleted,
create_time,
update_time
from back_user_account
where id = #{id}
</select>
<select id="countListBackUserAccount" resultType="java.lang.Integer" parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select count(*) from back_user_account
where is_deleted = 0
<select id="countListBackUserAccount" resultType="java.lang.Integer"
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select count(*) from back_user_account bua
left join user_role_rel urr on urr.user_account_id=bua.id
where bua.is_deleted = 0
<if test=" keyword != null and keyword != '' ">
and ( account_no like CONCAT("%",#{keyword},"%") or
user_name like CONCAT("%",#{keyword},"%") )
and ( bua.account_no like CONCAT("%",#{keyword},"%") or
bua.user_name like CONCAT("%",#{keyword},"%") )
</if>
<if test="provinceCode != null">
and province_code = #{provinceCode}
and bua.province_code = #{provinceCode}
</if>
<if test="cityCode != null">
and city_code = #{cityCode}
and bua.city_code = #{cityCode}
</if>
<if test="districtCode != null">
and district_code = #{districtCode}
and bua.district_code = #{districtCode}
</if>
<if test="accountStatus != null">
and account_status = #{accountStatus}
and bua.account_status = #{accountStatus}
</if>
<if test="roleId != null">
and urr.role_id = #{roleId}
</if>
</select>
<select id="listBackUserAccount" resultMap="backUserAccountResultMap" parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select id, account_no, phone_num, user_name, user_sex, email, account_status, province_code, city_code, district_code, address, remark, create_time, update_time
from back_user_account
where is_deleted = 0
<select id="listBackUserAccount" resultMap="backUserAccountResultMap"
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
SELECT
bua.id,
bua.account_no,
bua.phone_num,
bua.user_name,
bua.user_sex,
bua.email,
bua.account_status,
bua.province_code,
bua.city_code,
bua.district_code,
bua.address,
bua.remark,
bua.create_time,
bua.update_time
FROM
back_user_account bua
left join user_role_rel urr on urr.user_account_id=bua.id
WHERE
bua.is_deleted = 0
<if test=" keyword != null and keyword != '' ">
and ( account_no like CONCAT("%",#{keyword},"%") or
user_name like CONCAT("%",#{keyword},"%") )
and ( bua.account_no like CONCAT("%",#{keyword},"%") or
bua.user_name like CONCAT("%",#{keyword},"%") )
</if>
<if test="provinceCode != null">
and province_code = #{provinceCode}
and bua.province_code = #{provinceCode}
</if>
<if test="cityCode != null">
and city_code = #{cityCode}
and bua.city_code = #{cityCode}
</if>
<if test="districtCode != null">
and district_code = #{districtCode}
and bua.district_code = #{districtCode}
</if>
<if test="accountStatus != null">
and account_status = #{accountStatus}
and bua.account_status = #{accountStatus}
</if>
<if test="roleId != null">
and urr.role_id = #{roleId}
</if>
</select>
<select id="feignListBackUserAccount" resultMap="backUserAccountResultMap" parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select ua.id, ua.account_no, ua.phone_num, ua.user_name, ua.user_sex, ua.email, ua.account_status, ua.remark, ua.is_deleted as deleted, ua.create_time, ua.update_time
<select id="feignListBackUserAccount" resultMap="backUserAccountResultMap"
parameterType="com.mmc.iuav.user.model.qo.BUserAccountQO">
select ua.id, ua.account_no, ua.phone_num, ua.user_name, ua.user_sex, ua.email, ua.account_status, ua.remark,
ua.is_deleted as deleted, ua.create_time, ua.update_time
from back_user_account ua
where ua.is_deleted = 0
<if test=" userIds != null ">
......@@ -181,4 +231,4 @@
</if>
</select>
</mapper>
\ No newline at end of file
</mapper>
......@@ -3,39 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mmc.iuav.user.dao.MenuInfoDao">
<resultMap id="menuInfoResultMap" type="com.mmc.iuav.user.entity.MenuInfoDO">
<id property="id" column="id"/>
<result property="pid" column="pid"/>
<result property="menuName" column="menu_name"/>
<result property="portType" column="port_type"/>
<result property="domType" column="dom_type"/>
<result property="pathInfo" column="path_info"/>
<result property="icon" column="icon"/>
<result property="sort" column="sort"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<insert id="batchAddMenuIds">
insert into menu_role_rel
(
role_id,menu_id,create_time
)
values
<foreach collection="addMenuIds" item="menuId" separator=",">
(
#{roleId},#{menuId},NOW()
)
</foreach>
</insert>
<delete id="batchDeleteMenuIds">
delete from menu_role_rel where role_id = #{roleId} and menu_id in
<foreach collection="deleteMenuIds" item="menuId" open="(" separator=","
close=")">
#{menuId}
</foreach>
</delete>
<select id="listMenuInfo" resultType="com.mmc.iuav.user.entity.MenuInfoDO">
select m.id,m.pid,m.menu_name,m.dom_type,m.path_info
......@@ -43,12 +10,4 @@
order by m.sort ASC
</select>
<select id="listRoleMenuInfo" resultType="com.mmc.iuav.user.entity.MenuInfoDO">
select m.id,m.pid,m.menu_name,m.dom_type,m.path_info
from menu_info m
inner join menu_role_rel mr on mr.menu_id=m.id
where mr.role_id = #{roleId}
order by m.sort ASC
</select>
</mapper>
\ No newline at end of file
......@@ -18,6 +18,7 @@
<result property="userName" column="user_name"/>
<result property="updateTime" column="update_time"/>
<result property="userName" column="user_name"/>
<result property="superAdmin" column="super_admin"/>
</resultMap>
......@@ -65,10 +66,22 @@
<insert id="insertRoleInfo" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.iuav.user.entity.RoleInfoDO">
insert into role_info(role_no, role_name, user_account_id, remark, create_time)
values (#{roleNo}, #{roleName}, #{userAccountId}, #{remark}, NOW())
insert into role_info(role_no, role_name, user_account_id, remark, create_time, update_time)
values (#{roleNo}, #{roleName}, #{userAccountId}, #{remark}, NOW(), NOW())
</insert>
<insert id="batchAddMenuIds">
insert into menu_role_rel
(
role_id,menu_id,create_time
)
values
<foreach collection="addMenuIds" item="menuId" separator=",">
(
#{roleId},#{menuId},NOW()
)
</foreach>
</insert>
<update id="updateRoleInfo"
parameterType="com.mmc.iuav.user.entity.RoleInfoDO">
......@@ -90,13 +103,19 @@
where role_id = #{roleId}
</select>
<update id="removeRoleInfo" parameterType="int">
UPDATE role_info
<set>
is_deleted = 1
</set>
<delete id="removeRoleInfo" parameterType="java.lang.Integer">
delete
from role_info
where id = #{id}
</update>
</delete>
<delete id="batchDeleteMenuIds">
delete from menu_role_rel where role_id = #{roleId} and menu_id in
<foreach collection="deleteMenuIds" item="menuId" open="(" separator=","
close=")">
#{menuId}
</foreach>
</delete>
<select id="getRoleInfo" resultMap="roleInfoResultMap"
parameterType="int">
......@@ -115,7 +134,7 @@
SELECT count(*)
FROM
role_info r
INNER JOIN user_account ua ON r.user_account_id = ua.id
INNER JOIN back_user_account ua ON r.user_account_id = ua.id
WHERE
r.is_deleted =0
<if test=" NumberOrName != null and NumberOrName != '' ">
......@@ -134,11 +153,12 @@
r.remark,
r.create_time,
r.user_account_id,
r.super_admin,
ua.user_name,
r.update_time
FROM
role_info r
INNER JOIN user_account ua ON r.user_account_id = ua.id
INNER JOIN back_user_account ua ON r.user_account_id = ua.id
WHERE
r.is_deleted =0
<if test=" NumberOrName != null and NumberOrName != '' ">
......@@ -157,16 +177,20 @@
AND ua.is_deleted = 0
</select>
<select id="roleAccountList" resultMap="userAccountResultMap">
SELECT urr.user_account_id,
ua.user_name,
ua.uid,
ua.phone_num,
ua.user_name,
ua.is_deleted
FROM user_role_rel urr
LEFT JOIN user_account ua ON ua.id = urr.user_account_id
WHERE urr.role_id = #{id}
AND ua.is_deleted = 0
<select id="listRoleMenuInfo" resultType="com.mmc.iuav.user.entity.MenuInfoDO">
select m.id, m.pid, m.menu_name, m.dom_type, m.path_info
from menu_info m
inner join menu_role_rel mr on mr.menu_id = m.id
where mr.role_id = #{roleId}
order by m.sort ASC
</select>
<select id="findList" resultType="java.lang.String">
SELECT role_no
FROM role_info
where is_deleted = 0
ORDER BY id DESC LIMIT 1;
</select>
</mapper>
......@@ -18,4 +18,4 @@ patches:
images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/cms
newTag: 9b3bd9bc0f9cdefd5cdfedd1a0e7c575252b33e4
newTag: 4226adde5a2173ccfa143e69df821d3d19a368a0
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论