8/15 搜索用户加入仓库字段

workplace
wangwei 11 months ago
parent dcd227d367
commit 67726020ec

@ -53,6 +53,9 @@ public class AuthAdmin {
@TableField(exist = false) @TableField(exist = false)
private String deptName; private String deptName;
@TableField(exist = false)
private String invName;
@TableField(exist = false) @TableField(exist = false)
private List<SysRole> roles; private List<SysRole> roles;

@ -31,4 +31,5 @@ public class FilterAuthUserRequest extends ListPageRequest {
private String deptCode; private String deptCode;
private String invCode; //仓库号 private String invCode; //仓库号
private String key; private String key;
private String userKey;
} }

@ -3,6 +3,8 @@ package com.glxp.api.req.basic;
import com.glxp.api.util.page.ListPageRequest; import com.glxp.api.util.page.ListPageRequest;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author : zhangsan * @author : zhangsan
* @date : 2024/8/14 18:55 * @date : 2024/8/14 18:55
@ -13,7 +15,8 @@ import lombok.Data;
public class BasicCollectUserRequest extends ListPageRequest { public class BasicCollectUserRequest extends ListPageRequest {
private String userId; private String userId;
private String workplaceId; private List<String> workplaceId;
private String workplaceCode;
private String userKey; private String userKey;
private String workKey; private String workKey;

@ -39,6 +39,7 @@ public class AuthAdminResponse {
private List<Long> roles; private List<Long> roles;
private String dept; private String dept;
private String deptName; private String deptName;
private String invName;
private List<Long> depts; private List<Long> depts;

@ -3,6 +3,7 @@ package com.glxp.api.service.basic;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.glxp.api.req.basic.BasicCollectUserRequest; import com.glxp.api.req.basic.BasicCollectUserRequest;
import com.glxp.api.res.basic.UserWorkResponse; import com.glxp.api.res.basic.UserWorkResponse;
import org.aspectj.weaver.ast.Var;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.basic.BasicCollectUserMapper; import com.glxp.api.dao.basic.BasicCollectUserMapper;
@ -24,21 +25,27 @@ public class BasicCollectUserService extends ServiceImpl<BasicCollectUserMapper,
} }
public Boolean bindWorkplace(BasicCollectUserRequest request) { public Boolean bindWorkplace(BasicCollectUserRequest request) {
BasicCollectUserEntity basicCollectUserEntity = basicCollectUserMapper.selectOne(new LambdaQueryWrapper<BasicCollectUserEntity>() List<String> workplaceIds = request.getWorkplaceId();
.eq(BasicCollectUserEntity::getUserId, request.getUserId()) for (String workplaceId : workplaceIds) {
.eq(BasicCollectUserEntity::getWorkplaceCode,request.getWorkplaceId())); BasicCollectUserEntity basicCollectUserEntity = basicCollectUserMapper.selectOne(new LambdaQueryWrapper<BasicCollectUserEntity>()
if (basicCollectUserEntity != null){ .eq(BasicCollectUserEntity::getUserId, request.getUserId())
//该用户已经绑定改工位 .eq(BasicCollectUserEntity::getWorkplaceCode,workplaceId));
return false; if (basicCollectUserEntity != null){
//该用户已经绑定改工位
return false;
}
} }
BasicCollectUserEntity entity = new BasicCollectUserEntity();
entity.setUserId(Long.valueOf(request.getUserId())); for (String workplaceId : workplaceIds) {
entity.setWorkplaceCode(Long.valueOf(request.getWorkplaceId())); BasicCollectUserEntity entity = new BasicCollectUserEntity();
entity.setCreateTime(new Date()); entity.setUserId(Long.valueOf(request.getUserId()));
entity.setUpdateTime(new Date()); entity.setWorkplaceCode(Long.valueOf(workplaceId));
int insert = basicCollectUserMapper.insert(entity); entity.setCreateTime(new Date());
if (insert == 0){ entity.setUpdateTime(new Date());
return false; int insert = basicCollectUserMapper.insert(entity);
if (insert == 0){
return false;
}
} }
return true; return true;
} }

@ -4,9 +4,10 @@
<mapper namespace="com.glxp.api.dao.auth.AuthAdminDao"> <mapper namespace="com.glxp.api.dao.auth.AuthAdminDao">
<select id="listAdminPage" parameterType="com.glxp.api.req.auth.FilterAuthUserRequest" <select id="listAdminPage" parameterType="com.glxp.api.req.auth.FilterAuthUserRequest"
resultType="com.glxp.api.entity.auth.AuthAdmin"> resultType="com.glxp.api.entity.auth.AuthAdmin">
SELECT auth_user.*, auth_dept.name deptName SELECT auth_user.*, auth_dept.name deptName,aw.name invName
FROM auth_user FROM auth_user
left join auth_dept on auth_user.locDeptCode = auth_dept.code left join auth_dept on auth_user.locDeptCode = auth_dept.code
left join auth_warehouse aw on aw.code = auth_user.locInvCode
<where> <where>
<if test="ids != null and ids.size > 0"> <if test="ids != null and ids.size > 0">
AND id IN AND id IN
@ -23,6 +24,9 @@
<if test="neUserName != null and '' != neUserName"> <if test="neUserName != null and '' != neUserName">
AND userName != #{neUserName} AND userName != #{neUserName}
</if> </if>
<if test="invCode != null and '' != invCode">
AND locInvCode = #{invCode}
</if>
<if test="deptName != null and '' != deptName"> <if test="deptName != null and '' != deptName">
AND auth_dept.name LIKE CONCAT('%', #{deptName}, '%') AND auth_dept.name LIKE CONCAT('%', #{deptName}, '%')
</if> </if>
@ -33,6 +37,11 @@
, '%Y-%m-%d %H:%i:%S') , '%Y-%m-%d %H:%i:%S')
]]> ]]>
</if> </if>
<if test="userKey != null and userKey != ''">
AND (auth_user.userName like concat('%', #{userKey}, '%')
or auth_user.employeeName like concat('%', #{userKey}, '%')
)
</if>
<if test="deptCode != null and deptCode != ''"> <if test="deptCode != null and deptCode != ''">
AND auth_user.locDeptCode = #{deptCode} AND auth_user.locDeptCode = #{deptCode}
</if> </if>

@ -11,8 +11,8 @@
<if test=" userId != null and userId != ''"> <if test=" userId != null and userId != ''">
AND bcu.userId = #{userId} AND bcu.userId = #{userId}
</if> </if>
<if test=" workplaceId != null and workplaceId != ''"> <if test=" workplaceCode != null and workplaceCode != ''">
AND bcu.workplaceCode = #{workplaceId} AND bcu.workplaceCode = #{workplaceCode}
</if> </if>
<if test="userKey != null and userKey != ''"> <if test="userKey != null and userKey != ''">
AND (au.employeeName like concat('%', #{userKey}, '%') AND (au.employeeName like concat('%', #{userKey}, '%')

Loading…
Cancel
Save