数据权限

parent f6ae235e
package io.hmit.modules.dq.controller; package io.hmit.modules.dq.controller;
import io.hmit.common.annotation.DataFilter;
import io.hmit.common.annotation.LogOperation; import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.exception.ErrorCode; import io.hmit.common.exception.ErrorCode;
...@@ -59,6 +60,7 @@ public class DqPersonelController { ...@@ -59,6 +60,7 @@ public class DqPersonelController {
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String") @ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String")
}) })
@RequiresPermissions("dq:dqpersonel:page") @RequiresPermissions("dq:dqpersonel:page")
@DataFilter()
public Result<PageData<DqPersonelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){ public Result<PageData<DqPersonelDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<DqPersonelDTO> page = dqPersonelService.page(params); PageData<DqPersonelDTO> page = dqPersonelService.page(params);
...@@ -95,6 +97,8 @@ public class DqPersonelController { ...@@ -95,6 +97,8 @@ public class DqPersonelController {
//校验数据 //校验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
dto.setDeptId(dto.getDqRegionId());
dqPersonelService.update(dto); dqPersonelService.update(dto);
return new Result<>(); return new Result<>();
...@@ -126,6 +130,7 @@ public class DqPersonelController { ...@@ -126,6 +130,7 @@ public class DqPersonelController {
@ApiOperation("导出") @ApiOperation("导出")
@LogOperation("导出") @LogOperation("导出")
@RequiresPermissions("dq:dqpersonel:export") @RequiresPermissions("dq:dqpersonel:export")
@DataFilter()
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<DqPersonelDTO> list = dqPersonelService.list(params); List<DqPersonelDTO> list = dqPersonelService.list(params);
...@@ -134,7 +139,7 @@ public class DqPersonelController { ...@@ -134,7 +139,7 @@ public class DqPersonelController {
@PostMapping("upload") @PostMapping("upload")
@ApiOperation(value = "上传文件") @ApiOperation(value = "上传文件")
@RequiresPermissions("sys:oss:all") @RequiresPermissions("dq:dqpersonel:delete")
public Result<Map<String, Object>> upload(@RequestParam("file") MultipartFile file) throws Exception { public Result<Map<String, Object>> upload(@RequestParam("file") MultipartFile file) throws Exception {
if (file.isEmpty()) { if (file.isEmpty()) {
......
...@@ -70,7 +70,7 @@ public class DqRegionController { ...@@ -70,7 +70,7 @@ public class DqRegionController {
@GetMapping("list") @GetMapping("list")
@ApiOperation("列表") @ApiOperation("列表")
@RequiresPermissions("dq:dqregion:info") @RequiresPermissions("dq:dqpersonel:info")
public Result<List<DqRegionDTO>> list(){ public Result<List<DqRegionDTO>> list(){
return new Result<List<DqRegionDTO>>().ok(dqRegionService.list(new HashMap<>())); return new Result<List<DqRegionDTO>>().ok(dqRegionService.list(new HashMap<>()));
......
...@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; ...@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.constant.Constant;
import io.hmit.common.service.impl.CrudServiceImpl; import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.easyExcel.DqPersonelExcelIn; import io.hmit.common.utils.easyExcel.DqPersonelExcelIn;
import io.hmit.common.utils.easyExcel.DqPersonelExcelListener; import io.hmit.common.utils.easyExcel.DqPersonelExcelListener;
...@@ -42,8 +43,10 @@ public class DqPersonelServiceImpl extends CrudServiceImpl<DqPersonelDao, DqPers ...@@ -42,8 +43,10 @@ public class DqPersonelServiceImpl extends CrudServiceImpl<DqPersonelDao, DqPers
String id = (String)params.get("id"); String id = (String)params.get("id");
QueryWrapper<DqPersonelEntity> wrapper = new QueryWrapper<>(); QueryWrapper<DqPersonelEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id); wrapper.eq(StringUtils.isNotBlank(id), "id", id).orderByDesc("dq_region_id");
wrapper.orderByDesc("dq_region_id"); if(params.get(Constant.SQL_FILTER)!=null){
wrapper.apply(params.get(Constant.SQL_FILTER) != null, params.get(Constant.SQL_FILTER).toString());
}
return wrapper; return wrapper;
} }
......
package io.hmit.modules.sys.controller; package io.hmit.modules.sys.controller;
import io.hmit.common.annotation.DataFilter;
import io.hmit.common.annotation.LogOperation; import io.hmit.common.annotation.LogOperation;
import io.hmit.common.constant.Constant; import io.hmit.common.constant.Constant;
import io.hmit.common.exception.ErrorCode; import io.hmit.common.exception.ErrorCode;
...@@ -62,6 +63,7 @@ public class SysUserController { ...@@ -62,6 +63,7 @@ public class SysUserController {
@ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "String") @ApiImplicitParam(name = "deptId", value = "部门ID", paramType = "query", dataType = "String")
}) })
@RequiresPermissions("sys:user:page") @RequiresPermissions("sys:user:page")
@DataFilter(deptId = "dept_id")
public Result<PageData<SysUserDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) { public Result<PageData<SysUserDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
PageData<SysUserDTO> page = sysUserService.page(params); PageData<SysUserDTO> page = sysUserService.page(params);
...@@ -128,7 +130,7 @@ public class SysUserController { ...@@ -128,7 +130,7 @@ public class SysUserController {
/* SM 登录加密 */ /* SM 登录加密 */
// 对密码解密 // 对密码解密
dto.setPassword(SMUtil.SMDecryptSM2AndSM4(dto.getKey(), dto.getPassword())); // dto.setPassword(SMUtil.SMDecryptSM2AndSM4(dto.getKey(), dto.getPassword()));
/* ! SM 登录加密 */ /* ! SM 登录加密 */
sysUserService.save(dto); sysUserService.save(dto);
...@@ -147,7 +149,7 @@ public class SysUserController { ...@@ -147,7 +149,7 @@ public class SysUserController {
/* SM 登录加密 */ /* SM 登录加密 */
// 对密码解密 // 对密码解密
dto.setPassword(SMUtil.SMDecryptSM2AndSM4(dto.getKey(), dto.getPassword())); // dto.setPassword(SMUtil.SMDecryptSM2AndSM4(dto.getKey(), dto.getPassword()));
/* ! SM 登录加密 */ /* ! SM 登录加密 */
sysUserService.update(dto); sysUserService.update(dto);
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
<insert id="saveList"> <insert id="saveList">
INSERT INTO `dq_personel`(`name`,`idcard`,`idcard_type`,`community`,`address`,`dq_region_id`, INSERT INTO `dq_personel`(`name`,`idcard`,`idcard_type`,`community`,`address`,`dq_region_id`,
`mobile`,`type`,`status`,`age`,`body_status`,`data_status`) VALUES `mobile`,`type`,`status`,`age`,`body_status`,`data_status`,`dept_id`) VALUES
<foreach collection="list" separator="," item="item"> <foreach collection="list" separator="," item="item">
(#{item.name},#{item.idcard},#{item.idcardType},#{item.community},#{item.address},#{item.dqRegionId},#{item.mobile}, (#{item.name},#{item.idcard},#{item.idcardType},#{item.community},#{item.address},#{item.dqRegionId},#{item.mobile},
#{item.type},#{item.status},#{item.age},#{item.bodyStatus},#{item.dataStatus}) #{item.type},#{item.status},#{item.age},#{item.bodyStatus},#{item.dataStatus},#{item.deptId})
</foreach> </foreach>
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
idcard = values(idcard) idcard = values(idcard)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment