Просмотр исходного кода

Merge remote-tracking branch 'origin/dev_v1.0.0' into dev_v1.0.0

wangliang 1 год назад
Родитель
Сommit
a064fa94ac
16 измененных файлов с 140 добавлено и 25 удалено
  1. 3 3
      sop-business/src/main/java/com/qmth/sop/business/bean/result/SysCustomResult.java
  2. 33 0
      sop-business/src/main/java/com/qmth/sop/business/bean/result/SysCustomRoleResult.java
  3. 3 3
      sop-business/src/main/java/com/qmth/sop/business/bean/result/SysLevelResult.java
  4. 35 0
      sop-business/src/main/java/com/qmth/sop/business/bean/result/SysLevelRoleResult.java
  5. 4 1
      sop-business/src/main/java/com/qmth/sop/business/mapper/SysCustomRoleMapper.java
  6. 4 1
      sop-business/src/main/java/com/qmth/sop/business/mapper/SysLevelRoleMapper.java
  7. 7 1
      sop-business/src/main/java/com/qmth/sop/business/service/SysCustomRoleService.java
  8. 9 0
      sop-business/src/main/java/com/qmth/sop/business/service/SysLevelRoleService.java
  9. 6 1
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomRoleServiceImpl.java
  10. 5 3
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomServiceImpl.java
  11. 7 0
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysLevelRoleServiceImpl.java
  12. 4 3
      sop-business/src/main/java/com/qmth/sop/business/service/impl/SysLevelServiceImpl.java
  13. 8 4
      sop-business/src/main/resources/mapper/SysCustomRoleMapper.xml
  14. 9 1
      sop-business/src/main/resources/mapper/SysLevelRoleMapper.xml
  15. 1 2
      sop-server/src/main/java/com/qmth/sop/server/api/SysCustomController.java
  16. 2 2
      sop-server/src/main/java/com/qmth/sop/server/api/SysLevelController.java

+ 3 - 3
sop-business/src/main/java/com/qmth/sop/business/bean/result/SysCustomResult.java

@@ -30,13 +30,13 @@ public class SysCustomResult extends SysCustom implements Serializable {
     private String createName;
 
     @ApiModelProperty(value = "项目角色配置")
-    private List<SysCustomRole>  roleList;
+    private List<SysCustomRoleResult>  roleList;
 
-    public List<SysCustomRole> getRoleList() {
+    public List<SysCustomRoleResult> getRoleList() {
         return roleList;
     }
 
-    public void setRoleList(List<SysCustomRole> roleList) {
+    public void setRoleList(List<SysCustomRoleResult> roleList) {
         this.roleList = roleList;
     }
 

+ 33 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/SysCustomRoleResult.java

@@ -0,0 +1,33 @@
+package com.qmth.sop.business.bean.result;
+
+import com.qmth.sop.business.entity.SysCustom;
+import com.qmth.sop.business.entity.SysCustomRole;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 客户表
+ * </p>
+ *
+ * @author wangliang
+ * @since 2023-08-01
+ */
+
+public class SysCustomRoleResult extends SysCustomRole implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "角色名称")
+    private String roleName;
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+}

+ 3 - 3
sop-business/src/main/java/com/qmth/sop/business/bean/result/SysLevelResult.java

@@ -31,7 +31,7 @@ public class SysLevelResult extends SysLevel implements Serializable {
 
 
     @ApiModelProperty(value = "项目角色配置")
-    private List<SysLevelRole> roleList;
+    private List<SysLevelRoleResult> roleList;
 
     public String getCreateName() {
         return createName;
@@ -41,11 +41,11 @@ public class SysLevelResult extends SysLevel implements Serializable {
         this.createName = createName;
     }
 
-    public List<SysLevelRole> getRoleList() {
+    public List<SysLevelRoleResult> getRoleList() {
         return roleList;
     }
 
-    public void setRoleList(List<SysLevelRole> roleList) {
+    public void setRoleList(List<SysLevelRoleResult> roleList) {
         this.roleList = roleList;
     }
 }

+ 35 - 0
sop-business/src/main/java/com/qmth/sop/business/bean/result/SysLevelRoleResult.java

@@ -0,0 +1,35 @@
+package com.qmth.sop.business.bean.result;
+
+import com.qmth.sop.business.entity.SysLevel;
+import com.qmth.sop.business.entity.SysLevelRole;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * <p>
+ * 档位表
+ * </p>
+ *
+ * @author wangliang
+ * @since 2023-08-01
+ */
+public class SysLevelRoleResult extends SysLevelRole implements Serializable {
+
+
+
+
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "角色名称")
+    private String roleName;
+
+    public String getRoleName() {
+        return roleName;
+    }
+
+    public void setRoleName(String roleName) {
+        this.roleName = roleName;
+    }
+}

+ 4 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/SysCustomRoleMapper.java

@@ -2,9 +2,12 @@ package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.result.SysCustomRoleResult;
 import com.qmth.sop.business.entity.SysCustomRole;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -19,5 +22,5 @@ import java.util.Map;
 public interface SysCustomRoleMapper extends BaseMapper<SysCustomRole> {
 
 
-
+    List<SysCustomRoleResult> getList(@Param("customId") Long customId);
 }

+ 4 - 1
sop-business/src/main/java/com/qmth/sop/business/mapper/SysLevelRoleMapper.java

@@ -2,9 +2,12 @@ package com.qmth.sop.business.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.qmth.sop.business.bean.result.SysLevelRoleResult;
 import com.qmth.sop.business.entity.SysLevelRole;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -18,6 +21,6 @@ import java.util.Map;
  */
 public interface SysLevelRoleMapper extends BaseMapper<SysLevelRole> {
 
-	
 
+    List<SysLevelRoleResult> getList(@Param("levelId") Long levelId);
 }

+ 7 - 1
sop-business/src/main/java/com/qmth/sop/business/service/SysCustomRoleService.java

@@ -2,7 +2,10 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.SysCustomRoleResult;
 import com.qmth.sop.business.entity.SysCustomRole;
+
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -17,6 +20,9 @@ import java.util.Map;
 public interface SysCustomRoleService extends IService<SysCustomRole>{
 
 
-
+    /*
+        查询列表
+     */
+    List<SysCustomRoleResult> getList(Long customId);
 
 }

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysLevelRoleService.java

@@ -2,7 +2,11 @@ package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.sop.business.bean.result.SysCustomRoleResult;
+import com.qmth.sop.business.bean.result.SysLevelRoleResult;
 import com.qmth.sop.business.entity.SysLevelRole;
+
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -18,5 +22,10 @@ public interface SysLevelRoleService extends IService<SysLevelRole>{
 
 
 
+    /*
+        查询列表
+     */
+    List<SysLevelRoleResult> getList(Long levelId);
+
 
 }

+ 6 - 1
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomRoleServiceImpl.java

@@ -3,6 +3,7 @@ package com.qmth.sop.business.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.bean.result.SysCustomRoleResult;
 import com.qmth.sop.business.entity.SysCustomRole;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.mapper.SysCustomRoleMapper;
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -33,5 +35,8 @@ import java.util.Objects;
 public class SysCustomRoleServiceImpl extends ServiceImpl<SysCustomRoleMapper, SysCustomRole> implements SysCustomRoleService{
 
 
-
+    @Override
+    public List<SysCustomRoleResult> getList(Long customId) {
+        return this.baseMapper.getList(customId);
+    }
 }

+ 5 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomServiceImpl.java

@@ -46,7 +46,7 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
     public IPage<SysCustomResult> query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId) {
         IPage<SysCustomResult> sysCustomResultIPage = this.baseMapper.query(iPage, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(managerId) ? managerId : null, name, Objects.nonNull(levelId) ? levelId : null);
         sysCustomResultIPage.getRecords().forEach(e -> {
-            e.setRoleList(sysCustomRoleService.list(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, e.getId())));
+            e.setRoleList(sysCustomRoleService.getList(e.getId()));
         });
         return  sysCustomResultIPage;
     }
@@ -60,8 +60,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
         this.saveOrUpdate(sysCustom);
         sysCustom.getRoleList().forEach(e->{
             e.setCustomId(sysCustom.getId());
+            sysCustomRoleService.saveOrUpdate(e);
         });
-        sysCustomRoleService.saveBatch(sysCustom.getRoleList());
+
     }
 
     @Override
@@ -70,8 +71,9 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
         sysCustomRoleService.remove(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, sysCustom.getId()));
         sysCustom.getRoleList().forEach(e->{
             e.setCustomId(sysCustom.getId());
+            sysCustomRoleService.saveOrUpdate(e);
         });
-        sysCustomRoleService.saveBatch(sysCustom.getRoleList());
+       
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         sysCustom.setUpdateId(sysUser.getId());
         sysCustom.setUpdateTime(System.currentTimeMillis());

+ 7 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysLevelRoleServiceImpl.java

@@ -3,6 +3,7 @@ package com.qmth.sop.business.service.impl;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.sop.business.bean.result.SysLevelRoleResult;
 import com.qmth.sop.business.entity.SysLevelRole;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.mapper.SysLevelRoleMapper;
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -33,5 +35,10 @@ import java.util.Objects;
 public class SysLevelRoleServiceImpl extends ServiceImpl<SysLevelRoleMapper, SysLevelRole> implements SysLevelRoleService{
 
 
+    @Override
+    public List<SysLevelRoleResult> getList(Long levelId) {
+        return this.baseMapper.getList(levelId);
+    }
+
 
 }

+ 4 - 3
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysLevelServiceImpl.java

@@ -42,7 +42,7 @@ public class SysLevelServiceImpl extends ServiceImpl<SysLevelMapper, SysLevel> i
     public IPage<SysLevelResult> query(IPage<Map> iPage) {
         IPage<SysLevelResult> resultIPage = this.baseMapper.query(iPage);
         resultIPage.getRecords().forEach(e -> {
-            e.setRoleList(sysLevelRoleService.list(new QueryWrapper<SysLevelRole>().lambda().eq(SysLevelRole::getLevelId, e.getId())));
+            e.setRoleList(sysLevelRoleService.getList(e.getId()));
         });
         return resultIPage;
     }
@@ -57,8 +57,8 @@ public class SysLevelServiceImpl extends ServiceImpl<SysLevelMapper, SysLevel> i
     public void add(SysLevelResult sysLevel) {
         sysLevel.getRoleList().forEach(e->{
             e.setLevelId(sysLevel.getId());
+            sysLevelRoleService.saveOrUpdate(e);
         });
-        sysLevelRoleService.saveBatch(sysLevel.getRoleList());
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         sysLevel.setCreateId(sysUser.getId());
         sysLevel.setCreateTime(System.currentTimeMillis());
@@ -77,8 +77,9 @@ public class SysLevelServiceImpl extends ServiceImpl<SysLevelMapper, SysLevel> i
         sysLevelRoleService.remove(new QueryWrapper<SysLevelRole>().lambda().eq(SysLevelRole::getLevelId, sysLevel.getId()));
         sysLevel.getRoleList().forEach(e->{
             e.setLevelId(sysLevel.getId());
+            sysLevelRoleService.saveOrUpdate(e);
         });
-        sysLevelRoleService.saveBatch(sysLevel.getRoleList());
+
     }
 
     /**

+ 8 - 4
sop-business/src/main/resources/mapper/SysCustomRoleMapper.xml

@@ -2,9 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.SysCustomRoleMapper">
 
-    <select id="query" resultType="com.qmth.sop.business.entity.SysCustomRole">
-        select * from sys_custom_role a
-
-        order by a.create_time desc
+    <select id="getList" resultType="com.qmth.sop.business.bean.result.SysCustomRoleResult">
+        select a.*,r.name role_name from sys_custom_role a
+        left join sys_role r on r.id=a.role_id
+        <where>
+            <if test="customId != null and customId != ''">
+                and a.custom_id = #{customId}
+            </if>
+        </where>
     </select>
 </mapper>

+ 9 - 1
sop-business/src/main/resources/mapper/SysLevelRoleMapper.xml

@@ -1,5 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmth.sop.business.mapper.SysLevelRoleMapper">
-
+    <select id="getList" resultType="com.qmth.sop.business.bean.result.SysLevelRoleResult">
+        select a.*,r.name role_name from sys_level_role a
+        left join sys_role r on r.id=a.role_id
+        <where>
+            <if test="levelId != null and levelId != ''">
+                and a.level_id = #{levelId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 1 - 2
sop-server/src/main/java/com/qmth/sop/server/api/SysCustomController.java

@@ -57,7 +57,6 @@ public class SysCustomController {
     @Resource
     SysCustomRoleService sysCustomRoleService;
 
-    
     @ApiOperation(value = "客户表查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "客户表列表信息", response = SysCustomResult.class)})
@@ -110,7 +109,7 @@ public class SysCustomController {
     public Result detail(@ApiParam(value = "客户id", required = true) @RequestParam(required = true) long id) {
         SysCustom sysCustom = sysCustomService.getById(id);
         SysCustomResult sysCustomResult= JSON.toJavaObject((JSON) JSON.toJSON(sysCustom),SysCustomResult.class);
-        sysCustomResult.setRoleList(sysCustomRoleService.list(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, sysCustom.getId())));
+        sysCustomResult.setRoleList(sysCustomRoleService.getList(sysCustom.getId()));
         return ResultUtil.ok(sysCustomResult);
     }
 

+ 2 - 2
sop-server/src/main/java/com/qmth/sop/server/api/SysLevelController.java

@@ -47,7 +47,7 @@ public class SysLevelController {
     @Resource
     SysLevelRoleService sysLevelRoleService;
 
-   
+
     @ApiOperation(value = "档位表查询接口")
     @RequestMapping(value = "/query", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "档位表列表信息", response = SysLevelResult.class)})
@@ -112,7 +112,7 @@ public class SysLevelController {
     public Result get(@ApiParam(value = "档位表id", required = true) @RequestParam long id) {
         SysLevel sysLevel =sysLevelService.getById(id);
         SysLevelResult sysLevelResult= JSON.toJavaObject((JSON) JSON.toJSON(sysLevel),SysLevelResult.class);
-        sysLevelResult.setRoleList(sysLevelRoleService.list(new QueryWrapper<SysLevelRole>().lambda().eq(SysLevelRole::getLevelId, sysLevelResult.getId())));
+        sysLevelResult.setRoleList(sysLevelRoleService.getList(sysLevelResult.getId()));
         return ResultUtil.ok(sysLevelResult);
     }