Commit 008fdd68b023b091a56f1bd0af3dcf99694625e9
1 parent
783c743a
用户表绑定工位id功能
Showing
3 changed files
with
34 additions
and
2 deletions
src/main/java/com/huaheng/pc/agv/controller/WorkStationController.java
@@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | @@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | import com.baomidou.mybatisplus.core.metadata.IPage; | 4 | import com.baomidou.mybatisplus.core.metadata.IPage; |
5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | 5 | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | 6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
7 | +import com.huaheng.framework.aspectj.lang.annotation.ApiLogger; | ||
7 | import com.huaheng.framework.web.page.PageDomain; | 8 | import com.huaheng.framework.web.page.PageDomain; |
8 | import com.huaheng.framework.web.page.TableDataInfo; | 9 | import com.huaheng.framework.web.page.TableDataInfo; |
9 | import com.huaheng.framework.web.page.TableSupport; | 10 | import com.huaheng.framework.web.page.TableSupport; |
10 | import com.huaheng.common.utils.StringUtils; | 11 | import com.huaheng.common.utils.StringUtils; |
12 | +import com.huaheng.pc.system.user.domain.User; | ||
13 | +import com.huaheng.pc.system.user.service.IUserService; | ||
11 | import org.apache.shiro.authz.annotation.RequiresPermissions; | 14 | import org.apache.shiro.authz.annotation.RequiresPermissions; |
12 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.stereotype.Controller; | 16 | import org.springframework.stereotype.Controller; |
@@ -44,6 +47,9 @@ public class WorkStationController extends BaseController { | @@ -44,6 +47,9 @@ public class WorkStationController extends BaseController { | ||
44 | @Resource | 47 | @Resource |
45 | private IWorkStationService workStationService; | 48 | private IWorkStationService workStationService; |
46 | 49 | ||
50 | + @Resource | ||
51 | + private IUserService iUserService; | ||
52 | + | ||
47 | @RequiresPermissions("agv:workStation:view") | 53 | @RequiresPermissions("agv:workStation:view") |
48 | @GetMapping() | 54 | @GetMapping() |
49 | public String workStation() { | 55 | public String workStation() { |
@@ -136,4 +142,24 @@ public class WorkStationController extends BaseController { | @@ -136,4 +142,24 @@ public class WorkStationController extends BaseController { | ||
136 | return toAjax(workStationService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); | 142 | return toAjax(workStationService.removeByIds(Arrays.asList(Convert.toIntArray(ids)))); |
137 | } | 143 | } |
138 | 144 | ||
145 | + | ||
146 | + @RequiresPermissions("agv:workStation:view") | ||
147 | + @Log(title = "绑定工位", action = BusinessType.GRANT) | ||
148 | + @PostMapping("/bind") | ||
149 | + @ResponseBody | ||
150 | + @ApiLogger(apiName = "绑定工位", from = "PDA") | ||
151 | + public AjaxResult bind(String loginName, String workStationId){ | ||
152 | + User user = iUserService.selectUserByLoginName(loginName); | ||
153 | + if(user == null){ | ||
154 | + return AjaxResult.error("用户" + loginName + "不存在"); | ||
155 | + } | ||
156 | + | ||
157 | + WorkStation workStation = workStationService.getById(workStationId); | ||
158 | + if(workStation == null){ | ||
159 | + return AjaxResult.error("工位ID" + workStationId + "不存在"); | ||
160 | + } | ||
161 | + user.setWorkStationId(workStationId); | ||
162 | + iUserService.updateUserInfo(user); | ||
163 | + return AjaxResult.success(loginName + "成功绑定到" + workStation.getName() + "工位"); | ||
164 | + } | ||
139 | } | 165 | } |
src/main/java/com/huaheng/pc/system/user/domain/User.java
@@ -143,6 +143,10 @@ public class User implements Serializable | @@ -143,6 +143,10 @@ public class User implements Serializable | ||
143 | @TableField(value = "remark") | 143 | @TableField(value = "remark") |
144 | private String remark; | 144 | private String remark; |
145 | 145 | ||
146 | + /**工位id**/ | ||
147 | + @TableField(value = "workStationId") | ||
148 | + private String workStationId; | ||
149 | + | ||
146 | @TableField(exist = false) | 150 | @TableField(exist = false) |
147 | private Boolean admin; | 151 | private Boolean admin; |
148 | 152 |
src/main/resources/mybatis/system/UserMapper.xml
@@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
22 | <result property="updateBy" column="updateBy" /> | 22 | <result property="updateBy" column="updateBy" /> |
23 | <result property="updateTime" column="updateTime" /> | 23 | <result property="updateTime" column="updateTime" /> |
24 | <result property="remark" column="remark" /> | 24 | <result property="remark" column="remark" /> |
25 | + <result property="workStationId" column="workStationId" /> | ||
25 | <association property="dept" column="deptId" resultMap="deptResult" javaType="com.huaheng.pc.system.dept.domain.Dept"/> | 26 | <association property="dept" column="deptId" resultMap="deptResult" javaType="com.huaheng.pc.system.dept.domain.Dept"/> |
26 | </resultMap> | 27 | </resultMap> |
27 | 28 | ||
@@ -34,7 +35,7 @@ | @@ -34,7 +35,7 @@ | ||
34 | </resultMap> | 35 | </resultMap> |
35 | 36 | ||
36 | <sql id="selectUserVo"> | 37 | <sql id="selectUserVo"> |
37 | - select u.id, u.deptId, u.loginName, u.userName, u.email, u.phoneNumber, u.sex, u.avatar, u.password, u.salt, u.enable, u.deleted, u.loginIp, u.loginDate, u.createTime, u.remark, | 38 | + select u.id, u.deptId, u.loginName, u.userName, u.email, u.phoneNumber, u.sex, u.avatar, u.password, u.salt, u.enable, u.deleted, u.loginIp, u.loginDate, u.createTime, u.remark, u.workStationId, |
38 | d.id AS deptId, d.parentId, d.deptName, d.orderNum, d.enable as dept_enable | 39 | d.id AS deptId, d.parentId, d.deptName, d.orderNum, d.enable as dept_enable |
39 | from sys_user u | 40 | from sys_user u |
40 | left join sys_dept d on u.deptId = d.id | 41 | left join sys_dept d on u.deptId = d.id |
@@ -43,7 +44,7 @@ | @@ -43,7 +44,7 @@ | ||
43 | 44 | ||
44 | <select id="selectUserList" resultMap="UserResult"> | 45 | <select id="selectUserList" resultMap="UserResult"> |
45 | select u.id, u.deptId, u.loginName, u.userName, u.email, u.phoneNumber, u.password, u.sex, u.avatar, u.salt, u.enable, u.deleted, | 46 | select u.id, u.deptId, u.loginName, u.userName, u.email, u.phoneNumber, u.password, u.sex, u.avatar, u.salt, u.enable, u.deleted, |
46 | - u.loginIp, u.loginDate, u.createBy, u.createTime, u.updateTime, u.updateBy, u.remark, d.deptName | 47 | + u.loginIp, u.loginDate, u.createBy, u.createTime, u.updateTime, u.updateBy, u.remark, u.workStationId, d.deptName |
47 | from sys_user u | 48 | from sys_user u |
48 | left join sys_dept d on u.deptId = d.id | 49 | left join sys_dept d on u.deptId = d.id |
49 | WHERE u.deleted = false | 50 | WHERE u.deleted = false |
@@ -136,6 +137,7 @@ | @@ -136,6 +137,7 @@ | ||
136 | <if test="loginDate != null">loginDate = #{loginDate},</if> | 137 | <if test="loginDate != null">loginDate = #{loginDate},</if> |
137 | <if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if> | 138 | <if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if> |
138 | <if test="remark != null and remark != ''">remark = #{remark},</if> | 139 | <if test="remark != null and remark != ''">remark = #{remark},</if> |
140 | + <if test="workStationId != null and workStationId != ''">workStationId = #{workStationId},</if> | ||
139 | updateTime = sysdate() | 141 | updateTime = sysdate() |
140 | </set> | 142 | </set> |
141 | <where> | 143 | <where> |