Merge remote-tracking branch 'origin/HQPT_USER' into HQPT_USER
正在显示
5 个修改的文件
包含
33 行增加
和
22 行删除
@@ -6,6 +6,7 @@ import com.tianbo.warehouse.controller.response.ResultJson; | @@ -6,6 +6,7 @@ import com.tianbo.warehouse.controller.response.ResultJson; | ||
6 | import com.tianbo.warehouse.model.PERMISSION; | 6 | import com.tianbo.warehouse.model.PERMISSION; |
7 | import com.tianbo.warehouse.service.PermissionService; | 7 | import com.tianbo.warehouse.service.PermissionService; |
8 | import io.swagger.annotations.ApiOperation; | 8 | import io.swagger.annotations.ApiOperation; |
9 | +import org.apache.ibatis.annotations.Param; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
10 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
11 | 12 | ||
@@ -66,7 +67,8 @@ public class PermssionController { | @@ -66,7 +67,8 @@ public class PermssionController { | ||
66 | @DeleteMapping("/del") | 67 | @DeleteMapping("/del") |
67 | public ResultJson reomve(@RequestBody PERMISSION permission, HttpServletRequest request, HttpServletResponse response){ | 68 | public ResultJson reomve(@RequestBody PERMISSION permission, HttpServletRequest request, HttpServletResponse response){ |
68 | 69 | ||
69 | - int i =permissionService.deleteByPrimaryKey(permission.getPermissionId().toString()); | 70 | + Integer permissionId = permission.getPermissionId(); |
71 | + int i =permissionService.deleteByPrimaryKey(permission.getPermissionId()); | ||
70 | 72 | ||
71 | ResultJson resultJson = new ResultJson(); | 73 | ResultJson resultJson = new ResultJson(); |
72 | if (1==i){ | 74 | if (1==i){ |
@@ -78,15 +80,15 @@ public class PermssionController { | @@ -78,15 +80,15 @@ public class PermssionController { | ||
78 | } | 80 | } |
79 | 81 | ||
80 | @LogAnnotation(moduleName = "权限管理",operate = "权限批量删除") | 82 | @LogAnnotation(moduleName = "权限管理",operate = "权限批量删除") |
81 | - @GetMapping("/batchremove") | ||
82 | - public ResultJson reomve(String ids, HttpServletRequest request, HttpServletResponse response){ | 83 | + @PostMapping("/batchremove") |
84 | + public ResultJson reomve(@RequestBody List<Integer> ids, HttpServletRequest request, HttpServletResponse response){ | ||
83 | 85 | ||
84 | ResultJson resultJson = new ResultJson(); | 86 | ResultJson resultJson = new ResultJson(); |
85 | 87 | ||
86 | - if (permissionService.deleteByPrimaryKey(ids)>0){ | 88 | + if (permissionService.deleteByPrimaryKeys(ids)>0){ |
87 | resultJson = new ResultJson("200","删除成功"); | 89 | resultJson = new ResultJson("200","删除成功"); |
88 | }else { | 90 | }else { |
89 | - resultJson = new ResultJson("500","insert faild"); | 91 | + resultJson = new ResultJson("400","删除失败"); |
90 | } | 92 | } |
91 | return resultJson; | 93 | return resultJson; |
92 | } | 94 | } |
@@ -8,6 +8,8 @@ import java.util.List; | @@ -8,6 +8,8 @@ import java.util.List; | ||
8 | public interface PERMISSIONMapper { | 8 | public interface PERMISSIONMapper { |
9 | int deleteByPrimaryKey(Integer permissionId); | 9 | int deleteByPrimaryKey(Integer permissionId); |
10 | 10 | ||
11 | + int deleteByPrimaryKeys(List<Integer> permissionIds); | ||
12 | + | ||
11 | int insert(PERMISSION record); | 13 | int insert(PERMISSION record); |
12 | 14 | ||
13 | int insertSelective(PERMISSION record); | 15 | int insertSelective(PERMISSION record); |
@@ -26,7 +26,9 @@ public interface PermissionService { | @@ -26,7 +26,9 @@ public interface PermissionService { | ||
26 | 26 | ||
27 | int updateByPrimaryKeySelective(PERMISSION permission); | 27 | int updateByPrimaryKeySelective(PERMISSION permission); |
28 | 28 | ||
29 | - int deleteByPrimaryKey(String companyId); | 29 | + int deleteByPrimaryKey(Integer companyId); |
30 | + | ||
31 | + int deleteByPrimaryKeys(List<Integer> companyId); | ||
30 | 32 | ||
31 | /** | 33 | /** |
32 | * 登录验证成功后获取用户权限列表非树形结构 | 34 | * 登录验证成功后获取用户权限列表非树形结构 |
@@ -168,6 +168,16 @@ public class PermissionServiceImp implements PermissionService { | @@ -168,6 +168,16 @@ public class PermissionServiceImp implements PermissionService { | ||
168 | return permissionMapper.updateByPrimaryKeySelective(permission); | 168 | return permissionMapper.updateByPrimaryKeySelective(permission); |
169 | } | 169 | } |
170 | 170 | ||
171 | + /** 权限删除 | ||
172 | + * | ||
173 | + * @param permissionId | ||
174 | + * @return | ||
175 | + */ | ||
176 | + @RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp") | ||
177 | + @Override | ||
178 | + public int deleteByPrimaryKey(Integer permissionId) { | ||
179 | + return permissionMapper.deleteByPrimaryKey(permissionId); | ||
180 | + } | ||
171 | /** 批量删除 | 181 | /** 批量删除 |
172 | * | 182 | * |
173 | * @param permissionId | 183 | * @param permissionId |
@@ -175,22 +185,8 @@ public class PermissionServiceImp implements PermissionService { | @@ -175,22 +185,8 @@ public class PermissionServiceImp implements PermissionService { | ||
175 | */ | 185 | */ |
176 | @RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp") | 186 | @RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp") |
177 | @Override | 187 | @Override |
178 | - public int deleteByPrimaryKey(String permissionId) { | ||
179 | - if (permissionId.contains(",")) { | ||
180 | - try { | ||
181 | - String[] split = permissionId.split(","); | ||
182 | - for (int i = 0; i < split.length; i++) { | ||
183 | - permissionMapper.deleteByPrimaryKey(Integer.valueOf(split[i])); | ||
184 | - } | ||
185 | - System.out.println(); | ||
186 | - return 1; | ||
187 | - } catch (Exception e) { | ||
188 | - e.printStackTrace(); | ||
189 | - return 0; | ||
190 | - } | ||
191 | - } else { | ||
192 | - return permissionMapper.deleteByPrimaryKey(Integer.valueOf(permissionId)); | ||
193 | - } | 188 | + public int deleteByPrimaryKeys(List<Integer> permissionIds) { |
189 | + return permissionMapper.deleteByPrimaryKeys(permissionIds); | ||
194 | } | 190 | } |
195 | 191 | ||
196 | @RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp") | 192 | @RedisCacheDelTarget(cacheKey = "com.tianbo.warehouse.service.imp.PermissionServiceImp") |
@@ -180,6 +180,15 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order | @@ -180,6 +180,15 @@ where P.url = #{permissionUrl,jdbcType=VARCHAR} ORDER BY permission_order | ||
180 | delete from permission | 180 | delete from permission |
181 | where permission_id = #{permissionId,jdbcType=INTEGER} | 181 | where permission_id = #{permissionId,jdbcType=INTEGER} |
182 | </delete> | 182 | </delete> |
183 | + <delete id="deleteByPrimaryKeys" parameterType="list" > | ||
184 | + delete from permission | ||
185 | + <where> | ||
186 | + permission_id | ||
187 | + <foreach collection="permissionIds" item="id" separator="," open="in (" close=")"> | ||
188 | + #{id} | ||
189 | + </foreach> | ||
190 | + </where> | ||
191 | + </delete> | ||
183 | <insert id="insert" parameterType="com.tianbo.warehouse.model.PERMISSION" > | 192 | <insert id="insert" parameterType="com.tianbo.warehouse.model.PERMISSION" > |
184 | insert into permission (permission_id, name, permission_order, | 193 | insert into permission (permission_id, name, permission_order, |
185 | description, ismenu,hidden, parent_id, | 194 | description, ismenu,hidden, parent_id, |
-
请 注册 或 登录 后发表评论