sunruiqi преди 2 години
родител
ревизия
aa48f87006

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/domain/ProgramProjectListInfo.java

@@ -68,6 +68,8 @@ public class ProgramProjectListInfo {
     @Query(tableColumn = "a.client")
     private String client;
 
+    private String clientName;
+
     private String amount;
 
     private String contractType;
@@ -92,6 +94,8 @@ public class ProgramProjectListInfo {
 
     private String propertyHolder;
 
+    private String propertyHolderName;
+
     private String location;
 
     private String isFirst;
@@ -132,6 +136,8 @@ public class ProgramProjectListInfo {
 
     private String assessmentEnterprise;
 
+    private String assessmentEnterpriseName;
+
     private String linkNum;
 
     private String relationship;

+ 6 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/program/configuration/projectList/service/dto/ProjectListDto.java

@@ -24,6 +24,8 @@ public class ProjectListDto extends BaseEntity {
 
     private String client;
 
+    private String clientName;
+
     private String amount;
 
     private String contractType;
@@ -38,6 +40,8 @@ public class ProjectListDto extends BaseEntity {
 
     private String propertyHolder;
 
+    private String propertyHolderName;
+
     private String location;
 
     private String isFirst;
@@ -74,6 +78,8 @@ public class ProjectListDto extends BaseEntity {
 
     private String assessmentEnterprise;
 
+    private String assessmentEnterpriseName;
+
     private String linkNum;
 
     private String relationship;

+ 74 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/controller/ReimbursementTypeController.java

@@ -0,0 +1,74 @@
+package com.jeeplus.test.reimbursement.reimbursementType.controller;
+
+import com.jeeplus.test.reimbursement.reimbursementType.domain.ReimbursementTypeInfo;
+import com.jeeplus.test.reimbursement.reimbursementType.mapper.ReimbursementTypeMapper;
+import com.jeeplus.test.reimbursement.reimbursementType.service.ReimbursementTypeService;
+import com.jeeplus.test.reimbursement.reimbursementType.service.dto.ReimbursementTypeDto;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RestController
+@Api(tags ="报销类型管理")
+@RequestMapping(value = "/reimbursement/type")
+public class ReimbursementTypeController {
+
+    @Resource
+    private ReimbursementTypeService service;
+
+    @Resource
+    private ReimbursementTypeMapper mapper;
+
+    /**
+     * 列表查询
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "列表查询")
+    @GetMapping("/list")
+    public ResponseEntity<List<ReimbursementTypeInfo>> list(ReimbursementTypeInfo info) {
+        List<ReimbursementTypeInfo> list = service.list(info);
+        return ResponseEntity.ok(list);
+    }
+
+    /**
+     * 新增/修改
+     * @param info
+     * @return
+     */
+    @ApiOperation(value = "新增/修改")
+    @PostMapping("/save")
+    public ResponseEntity<String> save(@RequestBody ReimbursementTypeInfo info) {
+        String s = service.save(info);
+        return ResponseEntity.ok(s);
+    }
+
+    /**
+     * 根据id查询
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "根据id查询")
+    @GetMapping("/findById")
+    public ResponseEntity<ReimbursementTypeInfo> findById(String id) {
+        ReimbursementTypeInfo info = mapper.selectById(id);
+        return ResponseEntity.ok(info);
+    }
+
+    /**
+     * 根据id删除
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "根据id删除")
+    @GetMapping("/deleteById")
+    public ResponseEntity<String> deleteById(String id) {
+        mapper.deleteById(id);
+        return ResponseEntity.ok("操作完成");
+    }
+
+}

+ 28 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/domain/ReimbursementTypeInfo.java

@@ -0,0 +1,28 @@
+package com.jeeplus.test.reimbursement.reimbursementType.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.core.query.Query;
+import lombok.Data;
+
+@Data
+@TableName(value = "reimbursement_type_info")
+public class ReimbursementTypeInfo extends BaseEntity {
+
+    /**
+     * 报销类型名称
+     */
+    @Query
+    private String name;
+
+    /**
+     * 序号
+     */
+    @Query
+    private String no;
+
+    /**
+     * 父节点id
+     */
+    private String parentId;
+}

+ 18 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/ReimbursementTypeMapper.java

@@ -0,0 +1,18 @@
+package com.jeeplus.test.reimbursement.reimbursementType.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.reimbursement.reimbursementType.domain.ReimbursementTypeInfo;
+import org.apache.ibatis.annotations.Param;
+
+public interface ReimbursementTypeMapper extends BaseMapper<ReimbursementTypeInfo> {
+
+    /**
+     * 根据name和parentId查询名称是否重复
+     * @param name
+     * @param parentId
+     * @return
+     */
+    Integer checkNameIsExist(@Param("name") String name, @Param("parentId") String parentId);
+
+    Integer getNo(@Param("parentId") String parentId);
+}

+ 25 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/mapper/xml/ReimbursementTypeMapper.xml

@@ -0,0 +1,25 @@
+<?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.jeeplus.test.reimbursement.reimbursementType.mapper.ReimbursementTypeMapper">
+
+	<select id="checkNameIsExist" resultType="java.lang.Integer">
+		SELECT
+			COUNT( 0 )
+		FROM
+			reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND `name` = #{name}
+			AND parent_id = #{parentId}
+	</select>
+
+	<select id="getNo" resultType="java.lang.Integer">
+		SELECT
+			(MAX(`no`) + 1) AS `no`
+		FROM
+			reimbursement_type_info
+		WHERE
+			del_flag = 0
+			AND parent_id = #{parentId}
+	</select>
+</mapper>

+ 113 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/ReimbursementTypeService.java

@@ -0,0 +1,113 @@
+package com.jeeplus.test.reimbursement.reimbursementType.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.reimbursement.reimbursementType.domain.ReimbursementTypeInfo;
+import com.jeeplus.test.reimbursement.reimbursementType.mapper.ReimbursementTypeMapper;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class ReimbursementTypeService {
+
+    @Resource
+    private ReimbursementTypeMapper mapper;
+
+    public List<ReimbursementTypeInfo> list(ReimbursementTypeInfo info) {
+        LambdaQueryWrapper<ReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(BaseEntity::getDelFlag, 0);
+        if (StringUtils.isNotEmpty(info.getName())) {
+            wrapper.like(ReimbursementTypeInfo::getName, info.getName());
+        }
+        if (StringUtils.isNotEmpty(info.getNo())) {
+            wrapper.like(ReimbursementTypeInfo::getNo, info.getNo());
+        }
+        wrapper.orderByAsc(ReimbursementTypeInfo::getNo);
+        return mapper.selectList(wrapper);
+    }
+
+    public String save(ReimbursementTypeInfo info) {
+        // parentId未传值,则表示一级菜单
+        if(StringUtils.isEmpty(info.getParentId())) {
+            info.setParentId("0");
+        }
+        // 判断名称是否已存在
+        Integer isExist = mapper.checkNameIsExist(info.getName(), info.getParentId());
+        if (isExist > 0) {
+            return "false";
+        }
+        // 保存数据
+        if (StringUtils.isNotEmpty(info.getId())) {
+            return update(info);
+        }
+        return add(info);
+    }
+
+    /**
+     * 新增
+     * @param info
+     * @return
+     */
+    public String add(ReimbursementTypeInfo info) {
+        // 获取当前登录人信息
+        UserDTO userDto = UserUtils.getCurrentUserDTO();
+        // 生成id值
+        String id = UUID.randomUUID().toString().replace("-", "");
+        info.setId(id);
+        info.setCreateBy(userDto.getId());
+        info.setCreateDate(new Date());
+        info.setUpdateBy(userDto.getId());
+        info.setUpdateDate(new Date());
+        info.setDelFlag(0);
+        // 生成序号
+        info.setNo(getNo(info.getParentId()));
+        mapper.insert(info);
+        return "操作完成";
+    }
+
+    /**
+     * 修改
+     * @param info
+     * @return
+     */
+    public String update(ReimbursementTypeInfo info) {
+        // 获取当前登录人信息
+        UserDTO userDto = UserUtils.getCurrentUserDTO();
+        info.setUpdateBy(userDto.getId());
+        info.setUpdateDate(new Date());
+        mapper.updateById(info);
+        return "操作完成";
+    }
+
+    /**
+     * 生成序号
+     * @param parentId
+     * @return
+     */
+    public String getNo(String parentId) {
+        Integer no = mapper.getNo(parentId);
+        // 该层级下有数据,正常返回序号值
+        if (no != null) {
+            return no.toString();
+        } else {
+            // 该层级无数据,根据parentId查询父节点信息
+            LambdaQueryWrapper<ReimbursementTypeInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(BaseEntity::getDelFlag, 0);
+            wrapper.eq(BaseEntity::getId, parentId);
+            ReimbursementTypeInfo info = mapper.selectOne(wrapper);
+            // 父节点存在,根据父节点序号生成;不存在,则表示无上级层级,从1开始
+            if (info != null) {
+                return info.getNo() + "01";
+            } else {
+                return "1";
+            }
+        }
+    }
+}

+ 15 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/reimbursement/reimbursementType/service/dto/ReimbursementTypeDto.java

@@ -0,0 +1,15 @@
+package com.jeeplus.test.reimbursement.reimbursementType.service.dto;
+
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+@Data
+public class ReimbursementTypeDto extends BaseEntity {
+
+    private String name;
+
+    private String no;
+
+    private String parentId;
+
+}