Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

guoyujia před 1 rokem
rodič
revize
5e4dfc2d3a

+ 1 - 0
src/main/java/cn/ezhizao/project/business/controller/BizDayworkController.java

@@ -36,6 +36,7 @@ public class BizDayworkController extends BaseController {
     @Resource
     private IBizDayworkCarrierService bizDayworkCarrierService;
 
+
     @Resource
     private IBizProcessService bizProcessService;
 

+ 11 - 7
src/main/java/cn/ezhizao/project/business/controller/BizProductionPlanDetailSubDetailController.java

@@ -17,6 +17,7 @@ import cn.ezhizao.project.system.domain.SysDept;
 import cn.ezhizao.project.system.domain.SysDeptUser;
 import cn.ezhizao.project.system.service.ISysDeptService;
 import cn.ezhizao.project.system.service.ISysDeptUserService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -68,16 +69,19 @@ public class BizProductionPlanDetailSubDetailController extends BaseController {
      * 查询当前工段
      */
     @PreAuthorize("@ss.hasPermi('business:planDetailSubDetail:list')")
-    @Transactional
     @GetMapping("/getDept")
     public AjaxResult getDept() throws NoSuchFieldException, IllegalAccessException {
-         Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
-//        String tenantId = request.getHeader("tenantId");
-//        Long userId = 265L;
-        List<SysDeptUser> deptUserList = deptUserService.query().eq("user_id", userId).list();
+        Long userId = SecurityUtils.getLoginUser().getUser().getUserId();
+        String tenantId = request.getHeader("tenantId");
+
+        QueryWrapper<SysDeptUser> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", userId);
+        if (!"0".equals(tenantId)) {
+            queryWrapper.eq("tenant_id", Long.valueOf(tenantId));
+        }
+        List<SysDeptUser> deptUserList = deptUserService.list(queryWrapper);
         List<Long> ids = new ArrayList<>();
-        for (SysDeptUser item : deptUserList
-        ) {
+        for (SysDeptUser item : deptUserList) {
             ids.add(item.getDeptId());
         }
         List<SysDept> deptOptions = new ArrayList<>();

+ 13 - 19
src/main/java/cn/ezhizao/project/business/controller/BizResourceAllocationController.java

@@ -32,8 +32,7 @@ import cn.ezhizao.project.business.service.IBizResourceAllocationService;
  */
 @RestController
 @RequestMapping("/business/resourceAllocation")
-public class BizResourceAllocationController extends BaseController
-{
+public class BizResourceAllocationController extends BaseController {
     @Resource
     private IBizResourceAllocationService bizResourceAllocationService;
     @Resource
@@ -44,8 +43,7 @@ public class BizResourceAllocationController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:list')")
     @GetMapping("/list")
-    public TableDataInfo list(BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException
-    {
+    public TableDataInfo list(BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException {
         String tenantId = request.getHeader("tenantId");
         bizResourceAllocation.setTenantId(Long.valueOf(tenantId));
         startPage();
@@ -59,8 +57,7 @@ public class BizResourceAllocationController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:export')")
     @Log(title = "资源分配", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException
-    {
+    public void export(HttpServletResponse response, BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException {
         setTenantId(bizResourceAllocation);
         List<BizResourceAllocation> list = bizResourceAllocationService.getList(bizResourceAllocation);
         ExcelUtil<BizResourceAllocation> util = new ExcelUtil<BizResourceAllocation>(BizResourceAllocation.class);
@@ -72,8 +69,7 @@ public class BizResourceAllocationController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(bizResourceAllocationService.getById(id));
     }
 
@@ -83,19 +79,19 @@ public class BizResourceAllocationController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:add')")
     @Log(title = "资源分配", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult save(@RequestBody List<BizResourceAllocation> bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult save(@RequestBody List<BizResourceAllocation> bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException {
         String tenantId = request.getHeader("tenantId");
         QueryWrapper queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("tenant_id" , Long.valueOf(tenantId));
+        if (!"0".equals(tenantId)){
+            queryWrapper.eq("tenant_id", Long.valueOf(tenantId));
+        }
         queryWrapper.eq("dept_user_id", bizResourceAllocation.get(0).getDeptUserId());
         List<BizResourceAllocation> oldList = bizResourceAllocationService.list(queryWrapper);
-        for (BizResourceAllocation item: bizResourceAllocation
-             ) {
+        for (BizResourceAllocation item : bizResourceAllocation) {
             item.setTenantId(Long.valueOf(tenantId));
         }
 
-        return toAjax(saveOrUpdateBatch(bizResourceAllocationService,bizResourceAllocation,oldList));
+        return toAjax(saveOrUpdateBatch(bizResourceAllocationService, bizResourceAllocation, oldList));
     }
 
     /**
@@ -104,8 +100,7 @@ public class BizResourceAllocationController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:edit')")
     @Log(title = "资源分配", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException
-    {
+    public AjaxResult edit(@RequestBody BizResourceAllocation bizResourceAllocation) throws NoSuchFieldException, IllegalAccessException {
         String tenantId = request.getHeader("tenantId");
         bizResourceAllocation.setTenantId(Long.valueOf(tenantId));
         return toAjax(bizResourceAllocationService.updateById(bizResourceAllocation));
@@ -116,9 +111,8 @@ public class BizResourceAllocationController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('business:resourceAllocation:remove')")
     @Log(title = "资源分配", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable List<Long> ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids) {
         return toAjax(bizResourceAllocationService.removeBatchByIds(ids));
     }
 }

+ 1 - 1
src/main/resources/mybatis/business/BizProductionPlanDetailSubDetailMapper.xml

@@ -22,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deptId !=null and deptId !=''"> AND dept_id = #{deptId}</if>
             <if test="lotNumber != null "> AND lot_number = #{lotNumber}</if>
             <if test="deptId != null"> AND dept_id = #{deptId}</if>
-            <if test="tenantId != null  and tenantId != 0"> AND tenant_id = #{tenantId}</if>
+            <if test="tenantId != null and tenantId != 0"> AND tenant_id = #{tenantId}</if>
         </trim>
         ORDER BY create_time DESC
     </select>