diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/controller/DepadminlxController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/controller/DepadminlxController.java index 2c08804..862f830 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/controller/DepadminlxController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/controller/DepadminlxController.java @@ -10,9 +10,12 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.demo.depadminlx.entity.Depadminlx; import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; @@ -52,7 +55,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; public class DepadminlxController extends JeecgController { @Autowired private IDepadminlxService depadminlxService; - + /** * 分页列表查询 * @@ -69,12 +72,14 @@ public class DepadminlxController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(depadminlx, req.getParameterMap()); + queryWrapper.eq("userid",user.getId()); Page page = new Page(pageNo, pageSize); IPage pageList = depadminlxService.page(page, queryWrapper); return Result.OK(pageList); } - + /** * 添加 * @@ -86,10 +91,14 @@ public class DepadminlxController extends JeecgController add(@RequestBody Depadminlx depadminlx) { + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + depadminlx.setUserid(user.getId()); + String depiid = depadminlxService.getdepid(user.getId()); + depadminlx.setDepid(depiid); depadminlxService.save(depadminlx); return Result.OK("添加成功!"); } - + /** * 编辑 * @@ -104,7 +113,7 @@ public class DepadminlxController extends JeecgController { + @Select("select dep_id from sys_user_depart where user_id=#{id}") + String getdepid(String id); } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/IDepadminlxService.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/IDepadminlxService.java index 6830a3c..d044b48 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/IDepadminlxService.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/IDepadminlxService.java @@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IDepadminlxService extends IService { + String getdepid(String id); } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/impl/DepadminlxServiceImpl.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/impl/DepadminlxServiceImpl.java index 8c60899..c6b3bc7 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/impl/DepadminlxServiceImpl.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/service/impl/DepadminlxServiceImpl.java @@ -3,6 +3,7 @@ package org.jeecg.modules.demo.depadminlx.service.impl; import org.jeecg.modules.demo.depadminlx.entity.Depadminlx; import org.jeecg.modules.demo.depadminlx.mapper.DepadminlxMapper; import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -16,4 +17,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @Service public class DepadminlxServiceImpl extends ServiceImpl implements IDepadminlxService { + @Autowired + private DepadminlxMapper depadminlxMapper; + @Override + public String getdepid(String id) { + return depadminlxMapper.getdepid(id); + } } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java index 92f9469..6fcf93b 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/controller/DepfileController.java @@ -10,10 +10,14 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; import org.jeecg.modules.demo.depfile.entity.Depfile; import org.jeecg.modules.demo.depfile.service.IDepfileService; @@ -52,7 +56,10 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; public class DepfileController extends JeecgController { @Autowired private IDepfileService depfileService; - + + @Autowired + private IDepadminlxService depadminlxService; + /** * 分页列表查询 * @@ -69,12 +76,14 @@ public class DepfileController extends JeecgController @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(depfile, req.getParameterMap()); + queryWrapper.eq("userid",user.getId()); Page page = new Page(pageNo, pageSize); IPage pageList = depfileService.page(page, queryWrapper); return Result.OK(pageList); } - + /** * 添加 * @@ -86,10 +95,14 @@ public class DepfileController extends JeecgController @RequiresPermissions("depfile:depfile:add") @PostMapping(value = "/add") public Result add(@RequestBody Depfile depfile) { + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + depfile.setUserid(user.getId()); + String depiid = depadminlxService.getdepid(user.getId()); + depfile.setDepid(depiid); depfileService.save(depfile); return Result.OK("添加成功!"); } - + /** * 编辑 * @@ -104,7 +117,7 @@ public class DepfileController extends JeecgController depfileService.updateById(depfile); return Result.OK("编辑成功!"); } - + /** * 通过id删除 * @@ -119,7 +132,7 @@ public class DepfileController extends JeecgController depfileService.removeById(id); return Result.OK("删除成功!"); } - + /** * 批量删除 * @@ -134,7 +147,7 @@ public class DepfileController extends JeecgController this.depfileService.removeByIds(Arrays.asList(ids.split(","))); return Result.OK("批量删除成功!"); } - + /** * 通过id查询 * diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java index 0403607..542eada 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depfile/entity/Depfile.java @@ -80,4 +80,9 @@ public class Depfile implements Serializable { @Excel(name = "文件", width = 15) @ApiModelProperty(value = "文件") private String upfile; + + /**用户id*/ + @Excel(name = "用户id", width = 15) + @ApiModelProperty(value = "用户id") + private java.lang.String userid; } diff --git a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/controller/DepsbnczController.java b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/controller/DepsbnczController.java index fa8b637..9fbd656 100644 --- a/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/controller/DepsbnczController.java +++ b/jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/controller/DepsbnczController.java @@ -10,10 +10,14 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; + +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.query.QueryRuleEnum; +import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; import org.jeecg.modules.demo.depsbncz.entity.Depsbncz; import org.jeecg.modules.demo.depsbncz.service.IDepsbnczService; @@ -52,7 +56,9 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; public class DepsbnczController extends JeecgController { @Autowired private IDepsbnczService depsbnczService; - + @Autowired + private IDepadminlxService depadminlxService; + /** * 分页列表查询 * @@ -69,12 +75,14 @@ public class DepsbnczController extends JeecgController queryWrapper = QueryGenerator.initQueryWrapper(depsbncz, req.getParameterMap()); + queryWrapper.eq("userid",user.getId()); Page page = new Page(pageNo, pageSize); IPage pageList = depsbnczService.page(page, queryWrapper); return Result.OK(pageList); } - + /** * 添加 * @@ -86,10 +94,14 @@ public class DepsbnczController extends JeecgController add(@RequestBody Depsbncz depsbncz) { + LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); + depsbncz.setUserid(user.getId()); + String depiid = depadminlxService.getdepid(user.getId()); + depsbncz.setDepid(depiid); depsbnczService.save(depsbncz); return Result.OK("添加成功!"); } - + /** * 编辑 * @@ -104,7 +116,7 @@ public class DepsbnczController extends JeecgController