Browse Source

专家库 新增 问题修改

sunhh 2 years atrás
parent
commit
0f2d91bdf9

+ 7 - 7
purchase-admin/src/main/java/com/ozs/web/controller/base/BaseExpertController.java

@@ -50,15 +50,15 @@ public class BaseExpertController extends BaseController {
     @PostMapping("/insertExpert")
     @PreAuthorize("@ss.hasPermi('base:expert:insertExpert')")
     @Log(title = ModularConstans.policy, businessType = BusinessType.INSERT)
-    public AjaxResult insertExpert(@RequestBody BaseExpert baseExpert) {
-        if (StringUtils.isNull(baseExpert) || StringUtils.isNull(baseExpert.getExpertName())) {
+    public AjaxResult insertExpert(@RequestBody BaseExpertVo baseExpertVo) {
+        if (StringUtils.isNull(baseExpertVo) || StringUtils.isNull(baseExpertVo.getExpertName())) {
             return error("专家库名称不能为空");
         }
-        baseExpert.setCreated(getUserId().toString());
-        baseExpert.setCreateTime(new Date());
-        baseExpert.setUpdated(baseExpert.getCreated());
-        baseExpert.setUpdateTime(baseExpert.getCreateTime());
-        return toAjax(baseExpertService.insertExpert(baseExpert));
+        baseExpertVo.setCreated(getUserId().toString());
+        baseExpertVo.setCreateTime(new Date());
+        baseExpertVo.setUpdated(baseExpertVo.getCreated());
+        baseExpertVo.setUpdateTime(baseExpertVo.getCreateTime());
+        return toAjax(baseExpertService.insertExpert(baseExpertVo));
     }
 
     @ApiOperation(value = "删除专家库", notes = "必传 id")

+ 2 - 0
purchase-system/src/main/java/com/ozs/base/domain/vo/BaseExpertVo.java

@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 public class BaseExpertVo extends PageVo {
@@ -114,6 +115,7 @@ public class BaseExpertVo extends PageVo {
      */
     @ApiModelProperty(value = "所在区域(行政区域表的code)")
     private String localArea;
+    private List<String> localAreaList;
 
     /**
      * 所在区域

+ 2 - 1
purchase-system/src/main/java/com/ozs/base/mapper/BaseExpertMapper.java

@@ -3,6 +3,7 @@ package com.ozs.base.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.base.domain.BaseExpert;
 import com.ozs.base.domain.BaseUnitInformation;
+import com.ozs.base.domain.vo.BaseExpertVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -10,7 +11,7 @@ import java.util.List;
 
 @Mapper
 public interface BaseExpertMapper extends BaseMapper<BaseExpert> {
-    int insertExpert(BaseExpert baseExpert);
+    int insertExpert(BaseExpertVo baseExpertVo);
 
     List<BaseUnitInformation> selectByUnitInformation(@Param("unitInformation") String unitInformation);
 

+ 1 - 1
purchase-system/src/main/java/com/ozs/base/service/BaseExpertService.java

@@ -7,7 +7,7 @@ import com.ozs.base.domain.vo.BaseExpertVo;
 import com.ozs.common.core.domain.AjaxResult;
 
 public interface BaseExpertService  extends IService<BaseExpert> {
-    int insertExpert(BaseExpert baseExpert);
+    int insertExpert(BaseExpertVo baseExpertVo);
 
     int updateSupplierType(BaseExpert baseExpert);
 

+ 11 - 7
purchase-system/src/main/java/com/ozs/base/service/impl/BaseExpertServiceImpl.java

@@ -50,20 +50,24 @@ public class BaseExpertServiceImpl extends ServiceImpl<BaseExpertMapper, BaseExp
     private ISysDictDataService dictDataService;
 
     @Override
-    public int insertExpert(BaseExpert baseExpert) {
+    public int insertExpert(BaseExpertVo baseExpertVo) {
         // base_unit_information 单位信息表
-        if (StringUtils.isNotNull(baseExpert.getUnitInformation())) {
-            List<BaseUnitInformation> baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpert.getUnitInformation());
+        if (StringUtils.isNotNull(baseExpertVo.getUnitInformation())) {
+            List<BaseUnitInformation> baseUnitInformationList = baseExpertMapper.selectByUnitInformation(baseExpertVo.getUnitInformation());
             if (baseUnitInformationList.size() <= 0) {
                 BaseUnitInformation baseUnitInformation = new BaseUnitInformation();
-                baseUnitInformation.setUnitName(baseExpert.getUnitInformation());
-                baseUnitInformation.setCreated(baseExpert.getExpertName());
+                baseUnitInformation.setUnitName(baseExpertVo.getUnitInformation());
+                baseUnitInformation.setCreated(baseExpertVo.getExpertName());
                 baseUnitInformation.setCreateTime(new Date());
                 Integer i = baseExpertMapper.insertBaseUnitInformation(baseUnitInformation);
             }
         }
-
-        return baseExpertMapper.insertExpert(baseExpert);
+        // 区域list转字符串
+        if (StringUtils.isNotNull(baseExpertVo.getLocalAreaList())) {
+            String stringFromList = String.join(",", baseExpertVo.getLocalAreaList());
+            baseExpertVo.setLocalArea(stringFromList);
+        }
+        return baseExpertMapper.insertExpert(baseExpertVo);
     }
 
     @Override

+ 1 - 1
purchase-system/src/main/resources/mapper/base/BaseExpertMapper.xml

@@ -19,7 +19,7 @@
         <result property="idNumber" column="id_number"/>
     </resultMap>
 
-    <insert id="insertExpert" parameterType="com.ozs.base.domain.BaseExpert">
+    <insert id="insertExpert" parameterType="com.ozs.base.domain.vo.BaseExpert">
         insert into base_expert
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="expertName != null and expertName != '' ">