shudonghui 1 gadu atpakaļ
vecāks
revīzija
eeaf62d63a

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

@@ -1,7 +1,6 @@
 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;
@@ -31,13 +30,13 @@ public class SysCustomResult extends SysCustom implements Serializable {
     private String createName;
 
     @ApiModelProperty(value = "项目角色配置")
-    private List<SysCustomRoleResult>  roleList= new ArrayList<>();;
+    private List<SysLevelRoleResult>  roleList= new ArrayList<>();;
 
-    public List<SysCustomRoleResult> getRoleList() {
+    public List<SysLevelRoleResult> getRoleList() {
         return roleList;
     }
 
-    public void setRoleList(List<SysCustomRoleResult> roleList) {
+    public void setRoleList(List<SysLevelRoleResult> roleList) {
         this.roleList = roleList;
     }
 

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

@@ -1,33 +0,0 @@
-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;
-    }
-}

+ 0 - 90
sop-business/src/main/java/com/qmth/sop/business/entity/SysCustomRole.java

@@ -1,90 +0,0 @@
-package com.qmth.sop.business.entity;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
-import com.qmth.sop.common.base.BaseEntity;
-import com.qmth.sop.common.contant.SystemConstant;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * 客户角色配置表 模型.
- * 
- * @author: shudonghui
- * @date: 2023-08-10 08:23:57
- * @version: 1.0
- * @email: shudonghui@qmth.com.cn
- * @Company: www.qmth.com.cn
- */
-@ApiModel(value = "sys_custom_role对象", description = "客户角色配置表")
-public class SysCustomRole implements Serializable {
-
-	private static final long serialVersionUID = 1L;
-
-
-	@ApiModelProperty(value = "主键")
-	@JsonSerialize(using = ToStringSerializer.class)
-	private Long id;
-
-  	@ApiModelProperty(value = "客户id")
-	@JsonSerialize(using = ToStringSerializer.class)
-	@NotNull(message = "客户id不能为空")
-  	private long customId;
-  	@ApiModelProperty(value = "角色id")
-	@JsonSerialize(using = ToStringSerializer.class)
-	@NotNull(message = "角色id不能为空")
-  	private long roleId;
-  	@ApiModelProperty(value = "配额")
-	@JsonSerialize(using = ToStringSerializer.class)
-	@NotNull(message = "配额不能为空")
-  	private long quota;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	/**
-	 * 客户id
-	 */	
-  	public void setCustomId(long customId) {
-		this.customId = customId;
-  	}
- 	/**
-	 * 客户id
-	 */	 	
-  	public long getCustomId() {
-		return customId;
-  	}
-	/**
-	 * 角色id
-	 */	
-  	public void setRoleId(long roleId) {
-		this.roleId = roleId;
-  	}
- 	/**
-	 * 角色id
-	 */	 	
-  	public long getRoleId() {
-		return roleId;
-  	}
-	/**
-	 * 配额
-	 */	
-  	public void setQuota(long quota) {
-		this.quota = quota;
-  	}
- 	/**
-	 * 配额
-	 */	 	
-  	public long getQuota() {
-		return quota;
-  	}
-}

+ 0 - 26
sop-business/src/main/java/com/qmth/sop/business/mapper/SysCustomRoleMapper.java

@@ -1,26 +0,0 @@
-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;
-
-/**
- * 客户角色配置表 Mapper 接口.
- * 
- * @author: shudonghui
- * @date: 2023-08-10 08:23:58
- * @version: 1.0
- * @email: shudonghui@qmth.com.cn
- * @Company: www.qmth.com.cn
- */
-public interface SysCustomRoleMapper extends BaseMapper<SysCustomRole> {
-
-
-    List<SysCustomRoleResult> getList(@Param("customId") Long customId);
-}

+ 0 - 28
sop-business/src/main/java/com/qmth/sop/business/service/SysCustomRoleService.java

@@ -1,28 +0,0 @@
-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;
-
-/**
- * 客户角色配置表 服务类
- *
- * @author: shudonghui
- * @date: 2023-08-10 08:23:58
- * @version: 1.0
- * @email: shudonghui@qmth.com.cn
- * @Company: www.qmth.com.cn
- */
-public interface SysCustomRoleService extends IService<SysCustomRole>{
-
-
-    /*
-        查询列表
-     */
-    List<SysCustomRoleResult> getList(Long customId);
-
-}

+ 2 - 2
sop-business/src/main/java/com/qmth/sop/business/service/SysCustomService.java

@@ -28,9 +28,9 @@ public interface SysCustomService extends IService<SysCustom>{
     */
     IPage<SysCustomResult>  query(Page<Map> iPage, ProductTypeEnum type, Long managerId, String name, Long levelId);
 
-    void add(SysCustomResult sysCustom);
+    void add(SysCustom sysCustom);
 
-    void update(SysCustomResult sysCustom);
+    void update(SysCustom sysCustom);
 
     void delete(Long id);
 

+ 0 - 42
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysCustomRoleServiceImpl.java

@@ -1,42 +0,0 @@
-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;
-import com.qmth.sop.business.service.SysCustomRoleService;
-import com.qmth.sop.common.contant.SystemConstant;
-import com.qmth.sop.common.enums.ExceptionResultEnum;
-import com.qmth.sop.common.enums.FieldUniqueEnum;
-import com.qmth.sop.common.util.ResultUtil;
-import com.qmth.sop.common.util.ServletUtil;
-import org.springframework.dao.DuplicateKeyException;
-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;
-
-/**
- * 客户角色配置表 服务实现.
- *
- * @author: shudonghui
- * @date: 2023-08-10 08:23:58
- * @version: 1.0
- * @email: shudonghui@qmth.com.cn
- * @Company: www.qmth.com.cn
- */
-@Service
-public class SysCustomRoleServiceImpl extends ServiceImpl<SysCustomRoleMapper, SysCustomRole> implements SysCustomRoleService{
-
-
-    @Override
-    public List<SysCustomRoleResult> getList(Long customId) {
-        return this.baseMapper.getList(customId);
-    }
-}

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

@@ -6,13 +6,10 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.bean.result.SysCustomResult;
 import com.qmth.sop.business.entity.SysCustom;
-import com.qmth.sop.business.entity.SysCustomRole;
-import com.qmth.sop.business.entity.SysLevelRole;
 import com.qmth.sop.business.entity.SysUser;
 import com.qmth.sop.business.mapper.SysCustomMapper;
-import com.qmth.sop.business.service.SysCustomRoleService;
 import com.qmth.sop.business.service.SysCustomService;
-import com.qmth.sop.common.contant.SystemConstant;
+import com.qmth.sop.business.service.SysLevelRoleService;
 import com.qmth.sop.common.enums.ProductTypeEnum;
 import com.qmth.sop.common.util.ServletUtil;
 import org.springframework.stereotype.Service;
@@ -34,7 +31,7 @@ import java.util.Objects;
 @Service
 public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom> implements SysCustomService {
     @Resource
-    SysCustomRoleService sysCustomRoleService;
+    SysLevelRoleService sysLevelRoleService;
 
     /**
      * 查询列表
@@ -46,34 +43,24 @@ 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.getList(e.getId()));
+            e.setRoleList(sysLevelRoleService.getList(e.getId()));
         });
         return  sysCustomResultIPage;
     }
 
     @Override
     @Transactional
-    public void add(SysCustomResult sysCustom) {
+    public void add(SysCustom sysCustom) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         sysCustom.setCreateId(sysUser.getId());
         sysCustom.setCreateTime(System.currentTimeMillis());
         this.saveOrUpdate(sysCustom);
-        sysCustom.getRoleList().forEach(e->{
-            e.setCustomId(sysCustom.getId());
-            sysCustomRoleService.saveOrUpdate(e);
-        });
 
     }
 
     @Override
     @Transactional
-    public void update(SysCustomResult sysCustom) {
-        sysCustomRoleService.remove(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, sysCustom.getId()));
-        sysCustom.getRoleList().forEach(e->{
-            e.setCustomId(sysCustom.getId());
-            sysCustomRoleService.saveOrUpdate(e);
-        });
-       
+    public void update(SysCustom sysCustom) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         sysCustom.setUpdateId(sysUser.getId());
         sysCustom.setUpdateTime(System.currentTimeMillis());
@@ -84,7 +71,6 @@ public class SysCustomServiceImpl extends ServiceImpl<SysCustomMapper, SysCustom
     @Override
     @Transactional
     public void delete(Long id) {
-        sysCustomRoleService.remove(new QueryWrapper<SysCustomRole>().lambda().eq(SysCustomRole::getCustomId, id));
         this.removeById(id);
     }
 

+ 5 - 1
sop-business/src/main/resources/db/log/shudonghui_update_log.sql

@@ -212,4 +212,8 @@ UPDATE `sys_privilege` SET `name` = '工作台', `url` = 'workChildManage', `typ
 
 INSERT INTO sys_privilege
 (id, name, url, `type`, parent_id, `sequence`, property, related, enable, default_auth, front_display)
-VALUES(1040, '获取产品信息列表接口', '/api/admin/tb/product/list', 'URL', 64, 26, 'SYS', NULL, 1, 1, 0);
+VALUES(1040, '获取产品信息列表接口', '/api/admin/tb/product/list', 'URL', 64, 26, 'SYS', NULL, 1, 1, 0);
+
+
+---2023.8.18
+DROP TABLE IF EXISTS `sys_custom_role`;

+ 0 - 14
sop-business/src/main/resources/mapper/SysCustomRoleMapper.xml

@@ -1,14 +0,0 @@
-<?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.SysCustomRoleMapper">
-
-    <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>

+ 4 - 10
sop-server/src/main/java/com/qmth/sop/server/api/SysCustomController.java

@@ -8,7 +8,6 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.sop.business.bean.result.SysCustomResult;
 import com.qmth.sop.business.entity.SysCustom;
 import com.qmth.sop.business.entity.TBTask;
-import com.qmth.sop.business.service.SysCustomRoleService;
 import com.qmth.sop.business.service.SysCustomService;
 import com.qmth.sop.business.service.TBTaskService;
 import com.qmth.sop.business.templete.execute.AsyncSysCustomImportService;
@@ -53,8 +52,6 @@ public class SysCustomController {
     @Resource
     TBTaskService tbTaskService;
 
-    @Resource
-    SysCustomRoleService sysCustomRoleService;
 
 
     @ApiOperation(value = "客户表查询接口")
@@ -75,7 +72,7 @@ public class SysCustomController {
     @ApiOperation(value = "新增客户表接口")
     @RequestMapping(value = "/add", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "新增客户表信息", response = Object.class)})
-    public Result add(@Valid @ApiParam(value = "客户信息", required = true) @RequestBody(required = true) SysCustomResult sysCustom, BindingResult bindingResult) throws InterruptedException {
+    public Result add(@Valid @ApiParam(value = "客户信息", required = true) @RequestBody(required = true) SysCustom sysCustom, BindingResult bindingResult) throws InterruptedException {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
@@ -87,7 +84,7 @@ public class SysCustomController {
     @ApiOperation(value = "修改客户表接口")
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "修改客户表信息", response = Object.class)})
-    public Result update(@Valid @ApiParam(value = "客户信息", required = true) @RequestBody(required = true) SysCustomResult sysCustom, BindingResult bindingResult) throws InterruptedException {
+    public Result update(@Valid @ApiParam(value = "客户信息", required = true) @RequestBody(required = true) SysCustom sysCustom, BindingResult bindingResult) throws InterruptedException {
         if (bindingResult.hasErrors()) {
             return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
         }
@@ -112,12 +109,9 @@ public class SysCustomController {
 
     @ApiOperation(value = "获取单个客户")
     @RequestMapping(value = "/get", method = RequestMethod.GET)
-    @ApiResponses({@ApiResponse(code = 200, message = "获取单个客户", response = SysCustomResult.class)})
+    @ApiResponses({@ApiResponse(code = 200, message = "获取单个客户", response = SysCustom.class)})
     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.getList(sysCustom.getId()));
-        return ResultUtil.ok(sysCustomResult);
+        return ResultUtil.ok(sysCustomService.getById(id));
     }