李永德
1 month ago
19 changed files with 390 additions and 30 deletions
@ -1,12 +1,12 @@ |
|||||
package org.nl.wms.basedata.master.standard.controller; |
package org.nl.wms.basedata.master.classstandard.controller; |
||||
|
|
||||
import lombok.RequiredArgsConstructor; |
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||
import org.nl.common.TableDataInfo; |
import org.nl.common.TableDataInfo; |
||||
import org.nl.common.domain.query.PageQuery; |
import org.nl.common.domain.query.PageQuery; |
||||
import org.nl.modules.logging.annotation.Log; |
import org.nl.modules.logging.annotation.Log; |
||||
import org.nl.wms.basedata.master.standard.service.IClassStandardService; |
import org.nl.wms.basedata.master.classstandard.service.IClassStandardService; |
||||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.http.HttpStatus; |
import org.springframework.http.HttpStatus; |
||||
import org.springframework.http.ResponseEntity; |
import org.springframework.http.ResponseEntity; |
@ -1,9 +1,9 @@ |
|||||
package org.nl.wms.basedata.master.standard.service; |
package org.nl.wms.basedata.master.classstandard.service; |
||||
|
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import org.nl.common.domain.query.PageQuery; |
import org.nl.common.domain.query.PageQuery; |
||||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard; |
||||
|
|
||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||
import java.util.List; |
import java.util.List; |
@ -1,4 +1,4 @@ |
|||||
package org.nl.wms.basedata.master.standard.service.dao; |
package org.nl.wms.basedata.master.classstandard.service.dao; |
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableField; |
import com.baomidou.mybatisplus.annotation.TableField; |
@ -1,7 +1,7 @@ |
|||||
package org.nl.wms.basedata.master.standard.service.dao.mapper; |
package org.nl.wms.basedata.master.classstandard.service.dao.mapper; |
||||
|
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard; |
||||
|
|
||||
import java.util.ArrayList; |
import java.util.ArrayList; |
||||
|
|
@ -1,6 +1,6 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
<?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"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="org.nl.wms.basedata.master.standard.service.dao.mapper.ClassStandardMapper"> |
<mapper namespace="org.nl.wms.basedata.master.classstandard.service.dao.mapper.ClassStandardMapper"> |
||||
|
|
||||
<select id="getAllChildrenIds" resultType="java.lang.String"> |
<select id="getAllChildrenIds" resultType="java.lang.String"> |
||||
SELECT DISTINCT |
SELECT DISTINCT |
@ -1,4 +1,4 @@ |
|||||
package org.nl.wms.basedata.master.standard.service.dto; |
package org.nl.wms.basedata.master.classstandard.service.dto; |
||||
|
|
||||
import lombok.Data; |
import lombok.Data; |
||||
import java.io.Serializable; |
import java.io.Serializable; |
@ -1,7 +1,7 @@ |
|||||
package org.nl.wms.basedata.master.standard.service.dto; |
package org.nl.wms.basedata.master.classstandard.service.dto; |
||||
|
|
||||
import org.nl.common.domain.query.BaseQuery; |
import org.nl.common.domain.query.BaseQuery; |
||||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard; |
||||
|
|
||||
/** |
/** |
||||
* @author lyd |
* @author lyd |
@ -1,11 +1,11 @@ |
|||||
package org.nl.wms.basedata.master.standard.service.dto; |
package org.nl.wms.basedata.master.classstandard.service.dto; |
||||
|
|
||||
import com.baomidou.mybatisplus.annotation.TableField; |
import com.baomidou.mybatisplus.annotation.TableField; |
||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||
import lombok.Builder; |
import lombok.Builder; |
||||
import lombok.Data; |
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
import lombok.NoArgsConstructor; |
||||
import org.nl.wms.basedata.master.standard.service.dao.ClassStandard; |
import org.nl.wms.basedata.master.classstandard.service.dao.ClassStandard; |
||||
|
|
||||
import java.io.Serializable; |
import java.io.Serializable; |
||||
import java.util.List; |
import java.util.List; |
@ -0,0 +1,46 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.controller; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.nl.common.TableDataInfo; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.modules.logging.annotation.Log; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.IUserAreaPermissionService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.http.HttpStatus; |
||||
|
import org.springframework.http.ResponseEntity; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 区域权限管理 |
||||
|
* @Author: lyd |
||||
|
* @Date: 2024/10/18 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/api/userArea") |
||||
|
@Slf4j |
||||
|
public class UserAreaPermissionController { |
||||
|
@Autowired |
||||
|
private IUserAreaPermissionService userAreaPermissionService; |
||||
|
|
||||
|
@GetMapping |
||||
|
@Log(value = "查询用户信息", isAddLogTable = false) |
||||
|
public ResponseEntity<Object> query(@RequestParam Map whereJson, PageQuery page) { |
||||
|
return new ResponseEntity<>(TableDataInfo.build(userAreaPermissionService.pageQuery(whereJson, page)), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/queryUserArea") |
||||
|
@Log(value = "查询用户对应区域", isAddLogTable = false) |
||||
|
public ResponseEntity<Object> queryUserArea(@RequestBody JSONObject whereJson) { |
||||
|
return new ResponseEntity<>(userAreaPermissionService.queryUserArea(whereJson), HttpStatus.OK); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/save") |
||||
|
@Log("保存用户仓库信息") |
||||
|
public ResponseEntity<Object> save(@RequestBody JSONObject whereJson) { |
||||
|
userAreaPermissionService.save(whereJson); |
||||
|
return new ResponseEntity<>(HttpStatus.OK); |
||||
|
} |
||||
|
} |
@ -0,0 +1,5 @@ |
|||||
|
/** |
||||
|
* 区域权限管理相关内容 |
||||
|
* 基础的三层逻辑 |
||||
|
*/ |
||||
|
package org.nl.wms.basedata.st.areapermissions; |
@ -0,0 +1,43 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.service; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.system.service.user.dao.SysUser; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.dao.UserAreaPermission; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.vo.UsersVo; |
||||
|
import org.springframework.data.domain.Pageable; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author: lyd |
||||
|
* @Date: 2024/10/18 |
||||
|
*/ |
||||
|
public interface IUserAreaPermissionService extends IService<UserAreaPermission> { |
||||
|
/** |
||||
|
* 分页获取用户信息 |
||||
|
* |
||||
|
* @param whereJson 条件 |
||||
|
* @param page 分页参数 |
||||
|
* @return Map<String, Object> |
||||
|
*/ |
||||
|
IPage<UsersVo> pageQuery(Map whereJson, PageQuery page); |
||||
|
|
||||
|
/** |
||||
|
* 查询用户对应仓库 |
||||
|
* |
||||
|
* @param whereJson / |
||||
|
*/ |
||||
|
List<UserAreaPermission> queryUserArea(JSONObject whereJson); |
||||
|
|
||||
|
/** |
||||
|
* 保存 |
||||
|
* |
||||
|
* @param whereJson / |
||||
|
*/ |
||||
|
void save(JSONObject whereJson); |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.service.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
|
||||
|
/** |
||||
|
* 区域与人员关联表 |
||||
|
* @Author: lyd |
||||
|
* @Date: 2024/10/18 |
||||
|
*/ |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = false) |
||||
|
@TableName("st_ivt_userarea") |
||||
|
public class UserAreaPermission { |
||||
|
/** 区域 */ |
||||
|
private String product_area; |
||||
|
/** 用户id */ |
||||
|
private String user_id; |
||||
|
} |
@ -0,0 +1,20 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.service.dao.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.dao.UserAreaPermission; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.vo.UsersVo; |
||||
|
|
||||
|
/** |
||||
|
* @Author: lyd |
||||
|
* @Date: 2024/10/18 |
||||
|
*/ |
||||
|
public interface UserAreaPermissionMapper extends BaseMapper<UserAreaPermission> { |
||||
|
/** |
||||
|
* 分页查询获取用户信息 |
||||
|
* @param pages 分页 |
||||
|
* @param blurry 模糊查询 |
||||
|
* @return |
||||
|
*/ |
||||
|
IPage<UsersVo> selectPageLeftJoin(IPage<UsersVo> pages, String blurry); |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
<?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="org.nl.wms.basedata.st.areapermissions.service.dao.mapper.UserAreaPermissionMapper"> |
||||
|
|
||||
|
<select id="selectPageLeftJoin" resultType="org.nl.wms.basedata.st.areapermissions.service.vo.UsersVo"> |
||||
|
SELECT |
||||
|
sys_user.*, |
||||
|
dept.name |
||||
|
FROM |
||||
|
sys_user sys_user |
||||
|
LEFT JOIN sys_user_dept sdept ON sdept.user_id = sys_user.user_id |
||||
|
LEFT JOIN sys_dept dept ON dept.dept_id = sdept.dept_id |
||||
|
WHERE |
||||
|
sys_user.is_used = '1' |
||||
|
<if test="blurry != null"> |
||||
|
sys_user.username LIKE concat('%',#{blurry},'%') |
||||
|
OR |
||||
|
sys_user.person_name LIKE concat('%',#{blurry},'%') |
||||
|
</if> |
||||
|
ORDER BY username DESC |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,69 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import org.nl.common.domain.query.PageQuery; |
||||
|
import org.nl.modules.common.exception.BadRequestException; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.IUserAreaPermissionService; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.dao.UserAreaPermission; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.dao.mapper.UserAreaPermissionMapper; |
||||
|
import org.nl.wms.basedata.st.areapermissions.service.vo.UsersVo; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.LinkedList; |
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Author: lyd |
||||
|
* @Date: 2024/10/18 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class UserAreaPermissionServiceImpl extends ServiceImpl<UserAreaPermissionMapper, UserAreaPermission> implements IUserAreaPermissionService { |
||||
|
@Autowired |
||||
|
private UserAreaPermissionMapper userAreaPermissionMapper; |
||||
|
|
||||
|
@Override |
||||
|
public IPage<UsersVo> pageQuery(Map whereJson, PageQuery page) { |
||||
|
String blurry = ObjectUtil.isNotEmpty(whereJson.get("blurry")) ? (String) whereJson.get("blurry") : null; |
||||
|
IPage<UsersVo> pages = new Page<>(page.getPage() + 1, page.getSize()); |
||||
|
pages = userAreaPermissionMapper.selectPageLeftJoin(pages, blurry); |
||||
|
return pages; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<UserAreaPermission> queryUserArea(JSONObject whereJson) { |
||||
|
String userId = whereJson.getString("user_id"); |
||||
|
return this.list(new LambdaQueryWrapper<UserAreaPermission>().eq(UserAreaPermission::getUser_id, userId)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void save(JSONObject whereJson) { |
||||
|
JSONObject userInfo = whereJson.getJSONObject("jo"); |
||||
|
JSONArray areas = whereJson.getJSONArray("rows"); |
||||
|
if (ObjectUtil.isEmpty(userInfo)) { |
||||
|
throw new BadRequestException("用户数据不能为空!"); |
||||
|
} |
||||
|
String userId = userInfo.getString("user_id"); |
||||
|
// 先删除
|
||||
|
userAreaPermissionMapper.delete(new LambdaQueryWrapper<UserAreaPermission>() |
||||
|
.eq(UserAreaPermission::getUser_id, userId)); |
||||
|
// 后增加
|
||||
|
List<UserAreaPermission> list = new LinkedList<>(); |
||||
|
for (int i = 0; i < areas.size(); i++) { |
||||
|
JSONObject jsonObject = areas.getJSONObject(i); |
||||
|
UserAreaPermission userAreaPermission = new UserAreaPermission(); |
||||
|
userAreaPermission.setProduct_area(jsonObject.getString("product_area")); |
||||
|
userAreaPermission.setUser_id(userId); |
||||
|
list.add(userAreaPermission); |
||||
|
} |
||||
|
this.saveBatch(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,134 @@ |
|||||
|
package org.nl.wms.basedata.st.areapermissions.service.vo; |
||||
|
|
||||
|
import com.alibaba.fastjson.annotation.JSONField; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* <p> |
||||
|
* 用户表 |
||||
|
* </p> |
||||
|
* @author lyd |
||||
|
*/ |
||||
|
@Data |
||||
|
public class UsersVo implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 用户标识 |
||||
|
*/ |
||||
|
private String user_id; |
||||
|
|
||||
|
/** |
||||
|
* 登录账号 |
||||
|
*/ |
||||
|
private String username; |
||||
|
|
||||
|
/** |
||||
|
* 姓名 |
||||
|
*/ |
||||
|
private String person_name; |
||||
|
|
||||
|
/** |
||||
|
* 性别 |
||||
|
*/ |
||||
|
private String gender; |
||||
|
|
||||
|
/** |
||||
|
* 电话 |
||||
|
*/ |
||||
|
private String phone; |
||||
|
|
||||
|
/** |
||||
|
* 电子邮箱 |
||||
|
*/ |
||||
|
private String email; |
||||
|
|
||||
|
/** |
||||
|
* 头像地址 |
||||
|
*/ |
||||
|
private String avatar_name; |
||||
|
|
||||
|
/** |
||||
|
* 头像真实路径 |
||||
|
*/ |
||||
|
private String avatar_path; |
||||
|
|
||||
|
/** |
||||
|
* 密码 |
||||
|
*/ |
||||
|
private String password; |
||||
|
|
||||
|
/** |
||||
|
* 是否为admin账号 |
||||
|
*/ |
||||
|
private Boolean is_admin; |
||||
|
|
||||
|
/** |
||||
|
* 是否启用 |
||||
|
*/ |
||||
|
private Boolean is_used; |
||||
|
|
||||
|
/** |
||||
|
* 密码重置者 |
||||
|
*/ |
||||
|
private Long pwd_reset_user_id; |
||||
|
|
||||
|
/** |
||||
|
* 密码重置时间 |
||||
|
*/ |
||||
|
private Date pwd_reset_time; |
||||
|
|
||||
|
/** |
||||
|
* 创建人标识 |
||||
|
*/ |
||||
|
private String create_id; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String create_name; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date create_time; |
||||
|
|
||||
|
/** |
||||
|
* 修改人标识 |
||||
|
*/ |
||||
|
private String update_id; |
||||
|
|
||||
|
/** |
||||
|
* 修改人 |
||||
|
*/ |
||||
|
private String update_name; |
||||
|
|
||||
|
/** |
||||
|
* 修改时间 |
||||
|
*/ |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date update_time; |
||||
|
|
||||
|
/** |
||||
|
* 外部人员标识 |
||||
|
*/ |
||||
|
private String extperson_id; |
||||
|
|
||||
|
/** |
||||
|
* 外部用户标识 |
||||
|
*/ |
||||
|
private String extuser_id; |
||||
|
|
||||
|
/** |
||||
|
* 部门名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
} |
||||
|
|
Loading…
Reference in new issue