Kaynağa Gözat

新增:企业类型管理。

lym 4 yıl önce
ebeveyn
işleme
a02561a5d3

+ 85 - 0
carbon-admin/carbon-admin-common/src/main/java/com/hcloud/microserver/facade/carbon/entity/CustomerCompanyType.java

@@ -0,0 +1,85 @@
+package com.hcloud.microserver.facade.carbon.entity;
+
+import java.util.Date;
+
+public class CustomerCompanyType {
+    private String guid;
+
+    private String parentId;
+
+    private String typeName;
+
+    private String typeVal;
+
+    private Integer state;
+
+    private Date modifiedTime;
+
+    private String methodology;
+
+    private String typeDesc;
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid == null ? null : guid.trim();
+    }
+
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId == null ? null : parentId.trim();
+    }
+
+    public String getTypeName() {
+        return typeName;
+    }
+
+    public void setTypeName(String typeName) {
+        this.typeName = typeName == null ? null : typeName.trim();
+    }
+
+    public String getTypeVal() {
+        return typeVal;
+    }
+
+    public void setTypeVal(String typeVal) {
+        this.typeVal = typeVal == null ? null : typeVal.trim();
+    }
+
+    public Integer getState() {
+        return state;
+    }
+
+    public void setState(Integer state) {
+        this.state = state;
+    }
+
+    public Date getModifiedTime() {
+        return modifiedTime;
+    }
+
+    public void setModifiedTime(Date modifiedTime) {
+        this.modifiedTime = modifiedTime;
+    }
+
+    public String getMethodology() {
+        return methodology;
+    }
+
+    public void setMethodology(String methodology) {
+        this.methodology = methodology == null ? null : methodology.trim();
+    }
+
+    public String getTypeDesc() {
+        return typeDesc;
+    }
+
+    public void setTypeDesc(String typeDesc) {
+        this.typeDesc = typeDesc == null ? null : typeDesc.trim();
+    }
+}

+ 27 - 0
carbon-admin/carbon-admin-common/src/main/java/com/hcloud/microserver/facade/carbon/forms/CustomerCompanyTypeForm.java

@@ -0,0 +1,27 @@
+package com.hcloud.microserver.facade.carbon.forms;
+
+import com.hcloud.microserver.commoncore.base.BaseForm;
+import io.swagger.annotations.Api;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@Api("企业类型信息")
+public class CustomerCompanyTypeForm extends BaseForm {
+    private String guid;
+
+    private String parentId;
+
+    private String typeName;
+
+    private String typeVal;
+
+    private Integer state;
+
+    private Date modifiedTime;
+
+    private String methodology;
+
+    private String typeDesc;
+}

+ 59 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/controller/CustomerCompanyTypeController.java

@@ -0,0 +1,59 @@
+package com.hcloud.microserver.bank.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.bank.service.CustomerCompanyTypeService;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
+import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/customerCompanyType")
+public class CustomerCompanyTypeController extends BaseController {
+
+    @Autowired
+    private CustomerCompanyTypeService customerCompanyTypeService;
+
+    @PostMapping("/save")
+    public ResultVO save(@RequestBody CustomerCompanyType customerCompanyType){
+        int i = customerCompanyTypeService.save(customerCompanyType);
+        if (i > 0){
+            return success();
+        }
+        return failure();
+    }
+
+    @PostMapping("/update")
+    public ResultVO update(@RequestBody CustomerCompanyType customerCompanyType){
+        int i = customerCompanyTypeService.modifyByPrimaryKeySelective(customerCompanyType);
+        if (i > 0){
+            return success();
+        }
+        return failure();
+    }
+
+    @GetMapping("/findById")
+    public ResultVO findById(@RequestParam("guid") String guid){
+        CustomerCompanyType customerCompanyType = customerCompanyTypeService.queryByPrimaryKey(guid);
+        return success(customerCompanyType);
+    }
+
+    @GetMapping("/delete")
+    public ResultVO delete(@RequestParam("guid") String guid){
+        int i = customerCompanyTypeService.delByPrimaryKey(guid);
+        if (i > 0){
+            return success();
+        }
+        return failure();
+    }
+
+    @PostMapping("/list")
+    public ResultVO selectList(CustomerCompanyTypeForm customerCompanyTypeForm){
+        PageInfo<List<CustomerCompanyType>> pageInfo = customerCompanyTypeService.selectList(customerCompanyTypeForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+}

+ 25 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/dao/CustomerCompanyTypeMapper.java

@@ -0,0 +1,25 @@
+package com.hcloud.microserver.bank.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
+import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm;
+
+import java.util.List;
+
+public interface CustomerCompanyTypeMapper extends BaseMapper<CustomerCompanyType,String> {
+
+    /**
+     * 查询企业类型是否存在
+     * lym
+     * @param customerCompanyType
+     * @return
+     */
+    int isExist(CustomerCompanyType customerCompanyType);
+
+    /**
+     * 查询列表
+     * lym
+     * @return
+     */
+    List<CustomerCompanyType> selectList(CustomerCompanyTypeForm customerCompanyTypeForm);
+}

+ 19 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/service/CustomerCompanyTypeService.java

@@ -0,0 +1,19 @@
+package com.hcloud.microserver.bank.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
+import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyInfoForm;
+import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm;
+
+import java.util.List;
+
+public interface CustomerCompanyTypeService extends BaseServie<CustomerCompanyType,String> {
+
+    /**
+     * 查询列表
+     * lym
+     * @return
+     */
+    public PageInfo<List<CustomerCompanyType>> selectList(CustomerCompanyTypeForm customerCompanyTypeForm);
+}

+ 87 - 0
carbon-admin/carbon-admin-service/src/main/java/com/hcloud/microserver/bank/service/impl/CustomerCompanyTypeServiceImpl.java

@@ -0,0 +1,87 @@
+package com.hcloud.microserver.bank.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.bank.dao.CustomerCompanyTypeMapper;
+import com.hcloud.microserver.bank.service.CustomerCompanyTypeService;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.exception.GlobalException;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType;
+import com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class CustomerCompanyTypeServiceImpl implements CustomerCompanyTypeService {
+
+    @Resource
+    private CustomerCompanyTypeMapper customerCompanyTypeMapper;
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        CustomerCompanyType companyType = new CustomerCompanyType();
+        companyType.setGuid(guid);
+        companyType.setState(0);
+        return customerCompanyTypeMapper.updateByPrimaryKeySelective(companyType);
+    }
+
+    @Override
+    public int save(CustomerCompanyType record) {
+        record.setGuid(GetUUID.getUUID());
+        record.setModifiedTime(new Date());
+        return customerCompanyTypeMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(CustomerCompanyType record) {
+        isExist(record);
+        record.setGuid(GetUUID.getUUID());
+        record.setModifiedTime(new Date());
+        return customerCompanyTypeMapper.insertSelective(record);
+    }
+
+    @Override
+    public CustomerCompanyType queryByPrimaryKey(String guid) {
+        return customerCompanyTypeMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(CustomerCompanyType record) {
+        isExist(record);
+        record.setModifiedTime(new Date());
+        return customerCompanyTypeMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(CustomerCompanyType record) {
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(CustomerCompanyType record) {
+        return 0;
+    }
+
+    /**
+     * 验证是否唯一
+     * lym
+     * @param companyType
+     */
+    private void isExist(CustomerCompanyType companyType){
+        int i = customerCompanyTypeMapper.isExist(companyType);
+        if (i > 0){
+            throw new GlobalException(ResultEnum.FAILURE.getCode(),"该企业类型已存在!");
+        }
+    }
+
+    @Override
+    public PageInfo<List<CustomerCompanyType>> selectList(CustomerCompanyTypeForm customerCompanyTypeForm) {
+        PageHelper.startPage(customerCompanyTypeForm.getPageNum(),customerCompanyTypeForm.getPageSize());
+        List<CustomerCompanyType> list = customerCompanyTypeMapper.selectList(customerCompanyTypeForm);
+        return new PageInfo(list);
+    }
+}

+ 155 - 0
carbon-admin/carbon-admin-service/src/main/resources/mappers/CustomerCompanyTypeMapper.xml

@@ -0,0 +1,155 @@
+<?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.hcloud.microserver.bank.dao.CustomerCompanyTypeMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="parent_id" jdbcType="CHAR" property="parentId" />
+    <result column="type_name" jdbcType="VARCHAR" property="typeName" />
+    <result column="type_val" jdbcType="VARCHAR" property="typeVal" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+    <result column="methodology" jdbcType="VARCHAR" property="methodology" />
+    <result column="type_desc" jdbcType="VARCHAR" property="typeDesc" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, parent_id, type_name, type_val, state, modified_time, methodology, type_desc
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_customer_company_type
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_customer_company_type
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType">
+    insert into t_customer_company_type (guid, parent_id, type_name, 
+      type_val, state, modified_time, 
+      methodology, type_desc)
+    values (#{guid,jdbcType=CHAR}, #{parentId,jdbcType=CHAR}, #{typeName,jdbcType=VARCHAR}, 
+      #{typeVal,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}, 
+      #{methodology,jdbcType=VARCHAR}, #{typeDesc,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType">
+    insert into t_customer_company_type
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="parentId != null">
+        parent_id,
+      </if>
+      <if test="typeName != null">
+        type_name,
+      </if>
+      <if test="typeVal != null">
+        type_val,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+      <if test="methodology != null">
+        methodology,
+      </if>
+      <if test="typeDesc != null">
+        type_desc,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="parentId != null">
+        #{parentId,jdbcType=CHAR},
+      </if>
+      <if test="typeName != null">
+        #{typeName,jdbcType=VARCHAR},
+      </if>
+      <if test="typeVal != null">
+        #{typeVal,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="methodology != null">
+        #{methodology,jdbcType=VARCHAR},
+      </if>
+      <if test="typeDesc != null">
+        #{typeDesc,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType">
+    update t_customer_company_type
+    <set>
+      <if test="parentId != null">
+        parent_id = #{parentId,jdbcType=CHAR},
+      </if>
+      <if test="typeName != null">
+        type_name = #{typeName,jdbcType=VARCHAR},
+      </if>
+      <if test="typeVal != null">
+        type_val = #{typeVal,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="methodology != null">
+        methodology = #{methodology,jdbcType=VARCHAR},
+      </if>
+      <if test="typeDesc != null">
+        type_desc = #{typeDesc,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType">
+    update t_customer_company_type
+    set parent_id = #{parentId,jdbcType=CHAR},
+      type_name = #{typeName,jdbcType=VARCHAR},
+      type_val = #{typeVal,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      methodology = #{methodology,jdbcType=VARCHAR},
+      type_desc = #{typeDesc,jdbcType=VARCHAR}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+
+  <!-- 查询企业类型是否存在 lym -->
+  <select id="isExist" parameterType="com.hcloud.microserver.facade.carbon.entity.CustomerCompanyType" resultType="int">
+    SELECT IFNULL(COUNT(*),0) FROM t_customer_company_type
+    where state = 1
+    <if test="parentId != null and parentId != ''">
+      AND parent_id = #{parentId}
+    </if>
+    <if test="typeName != null and typeName != ''">
+      AND type_name = #{typeName}
+    </if>
+    <if test="guid != null and guid != ''">
+      AND guid != #{guid}
+    </if>
+  </select>
+
+  <!-- 查询列表 lym -->
+  <select id="selectList" resultType="com.hcloud.microserver.facade.carbon.forms.CustomerCompanyTypeForm" resultMap="BaseResultMap">
+    SELECT <include refid="Base_Column_List"/> FROM t_customer_company_type
+    where state = 1
+    <if test="parentId != null and parentId != ''">
+      AND parent_id = #{parentId}
+    </if>
+    <if test="typeName != null and typeName != ''">
+      AND type_name LIKE CONCAT("%",#{typeName},"%")
+    </if>
+  </select>
+</mapper>