Explorar o código

增加获取参数接口

guq %!s(int64=7) %!d(string=hai) anos
pai
achega
dc767d9724

+ 102 - 0
applications/commons/commons-dto/src/main/java/com/usoftchina/saas/commons/po/Configs.java

@@ -0,0 +1,102 @@
+package com.usoftchina.saas.commons.po;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import java.util.Date;
+
+/** 系统参数
+ * @author: guq
+ * @create: 2018-11-16 11:19
+ **/
+public class Configs {
+
+    private Long id;
+
+    private String code;
+
+    private String description;
+
+    private String data;
+
+    private Long companyId;
+
+    private String creatorName;
+
+    private Integer creatorId;
+
+    private Date createTime;
+
+    private String updaterName;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code == null ? null : code.trim();
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description == null ? null : description.trim();
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data == null ? null : data.trim();
+    }
+
+    public Long getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Long companyId) {
+        this.companyId = companyId;
+    }
+
+    public String getCreatorName() {
+        return creatorName;
+    }
+
+    public void setCreatorName(String creatorName) {
+        this.creatorName = creatorName == null ? null : creatorName.trim();
+    }
+
+    public Integer getCreatorId() {
+        return creatorId;
+    }
+
+    public void setCreatorId(Integer creatorId) {
+        this.creatorId = creatorId;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdaterName() {
+        return updaterName;
+    }
+
+    public void setUpdaterName(String updaterName) {
+        this.updaterName = updaterName == null ? null : updaterName.trim();
+    }
+}

+ 44 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/controller/ConfigsController.java

@@ -0,0 +1,44 @@
+package com.usoftchina.saas.commons.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.po.Configs;
+import com.usoftchina.saas.commons.service.ConfigsService;
+import com.usoftchina.saas.page.PageRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author: guq
+ * @create: 2018-11-16 10:05
+ **/
+@RestController
+@RequestMapping("/configs")
+public class ConfigsController {
+
+    @Autowired
+    private ConfigsService configsService;
+
+    @GetMapping("/list")
+    public Result<Configs> getListData(PageRequest page, ListReqDTO req) {
+        PageInfo<Configs> listData = configsService.getListData(page, req);
+        return Result.success(listData);
+    }
+
+    @GetMapping("/getConfigByCode")
+    public Result<Configs> getConfigByCode(String code) {
+        Configs data = configsService.getConfigByCode(code);
+        return Result.success(data);
+    }
+
+    @GetMapping("/save")
+    public Result<DocBaseDTO> save(Configs data) {
+        DocBaseDTO baseDTO = configsService.save(data);
+        return Result.success(baseDTO);
+    }
+
+}

+ 24 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/mapper/ConfigsMapper.java

@@ -0,0 +1,24 @@
+package com.usoftchina.saas.commons.mapper;
+
+import com.usoftchina.saas.commons.po.Configs;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface ConfigsMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Configs record);
+
+    int insertSelective(Configs record);
+
+    Configs selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Configs record);
+
+    int updateByPrimaryKey(Configs record);
+
+    List<Configs> selectByCondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    void updateCreator(@Param("userId") Long userId, @Param("userName") String userName, @Param("id") Long id);
+}

+ 15 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/ConfigsService.java

@@ -0,0 +1,15 @@
+package com.usoftchina.saas.commons.service;
+
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.po.Configs;
+import com.usoftchina.saas.page.PageRequest;
+
+public interface ConfigsService {
+    PageInfo getListData(PageRequest page, ListReqDTO req);
+
+    Configs getConfigByCode(String code);
+
+    DocBaseDTO save(Configs data);
+}

+ 92 - 0
applications/commons/commons-server/src/main/java/com/usoftchina/saas/commons/service/impl/ConfigsServiceImpl.java

@@ -0,0 +1,92 @@
+package com.usoftchina.saas.commons.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.usoftchina.saas.commons.dto.DocBaseDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.mapper.ConfigsMapper;
+import com.usoftchina.saas.commons.po.Configs;
+import com.usoftchina.saas.commons.po.Status;
+import com.usoftchina.saas.commons.service.ConfigsService;
+import com.usoftchina.saas.commons.service.MessageLogService;
+import com.usoftchina.saas.context.BaseContextHolder;
+import com.usoftchina.saas.exception.BizException;
+import com.usoftchina.saas.page.PageDefault;
+import com.usoftchina.saas.page.PageRequest;
+import com.usoftchina.saas.utils.BeanMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+
+/**
+ * @author: guq
+ * @create: 2018-11-16 11:35
+ **/
+@Service
+public class ConfigsServiceImpl implements ConfigsService{
+
+    @Autowired
+    private ConfigsMapper configsMapper;
+    @Autowired
+    private MessageLogService messageLogService;
+
+
+    @Override
+    public PageInfo getListData(@PageDefault(size = 10) PageRequest page, ListReqDTO req) {
+        Long companyId = BaseContextHolder.getCompanyId();
+        PageHelper.startPage(page.getNumber(), page.getSize());
+        List<Configs> list = configsMapper.selectByCondition(req.getFinalCondition(), companyId);
+        //取分页信息
+        PageInfo<Configs> pageInfo = new PageInfo<Configs>(list);
+        return pageInfo;
+    }
+
+    @Override
+    public Configs getConfigByCode(String code) {
+        if (StringUtils.isEmpty(code)) {
+            return null;
+        }
+        List<Configs> list = configsMapper.selectByCondition(code, BaseContextHolder.getCompanyId());
+        if (null != list && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public DocBaseDTO save(Configs formdata) {
+        if (null == formdata){
+            throw new BizException(50000, "数据为空,请填写后再保存");
+        }
+        //公司ID
+        Long companyId = BaseContextHolder.getCompanyId();
+        //人员Id
+        Long userId = BaseContextHolder.getUserId();
+        String name = BaseContextHolder.getUserName();
+        //返回对象
+        DocBaseDTO baseDTO = null;
+        Long id = formdata.getId();
+
+        //判断更新与保存动作
+        if (StringUtils.isEmpty(id) || "0".equals(id.toString())) {
+            //插入操作
+            formdata.setCompanyId(companyId);
+            configsMapper.insertSelective(formdata);
+            id = formdata.getId();
+            configsMapper.updateCreator(userId, name, id);
+            baseDTO = new DocBaseDTO(id, formdata.getCode(), "Configs");
+            //日志记录
+            messageLogService.save(baseDTO);
+            return baseDTO;
+        }
+
+        //更新操作
+        configsMapper.updateByPrimaryKeySelective(formdata);
+        baseDTO = new DocBaseDTO(id, formdata.getCode(), "Configs");
+        //日志
+        messageLogService.update(baseDTO);
+        return baseDTO;
+    }
+}

+ 159 - 0
applications/commons/commons-server/src/main/resources/mapper/ConfigsMapper.xml

@@ -0,0 +1,159 @@
+<?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.usoftchina.saas.commons.mapper.ConfigsMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.commons.po.Configs" >
+    <id column="id" property="id" jdbcType="INTEGER" />
+    <result column="code" property="code" jdbcType="VARCHAR" />
+    <result column="description" property="description" jdbcType="VARCHAR" />
+    <result column="data" property="data" jdbcType="VARCHAR" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+    <result column="creatorName" property="creatorName" jdbcType="VARCHAR" />
+    <result column="creatorId" property="creatorId" jdbcType="INTEGER" />
+    <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
+    <result column="updaterName" property="updaterName" jdbcType="VARCHAR" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    id, code, description, data, companyId, creatorName, creatorId, createTime, updaterName
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select
+    <include refid="Base_Column_List" />
+    from configs
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
+    delete from configs
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.commons.po.Configs" >
+    insert into configs (id, code, description,
+    data, companyId, creatorName,
+    creatorId, createTime, updaterName
+    )
+    values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
+    #{data,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, #{creatorName,jdbcType=VARCHAR},
+    #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updaterName,jdbcType=VARCHAR}
+    )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.commons.po.Configs" >
+    insert into configs
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        id,
+      </if>
+      <if test="code != null" >
+        code,
+      </if>
+      <if test="description != null" >
+        description,
+      </if>
+      <if test="data != null" >
+        data,
+      </if>
+      <if test="companyId != null" >
+        companyId,
+      </if>
+      <if test="creatorName != null" >
+        creatorName,
+      </if>
+      <if test="creatorId != null" >
+        creatorId,
+      </if>
+      <if test="createTime != null" >
+        createTime,
+      </if>
+      <if test="updaterName != null" >
+        updaterName,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="id != null" >
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="code != null" >
+        #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="description != null" >
+        #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="data != null" >
+        #{data,jdbcType=VARCHAR},
+      </if>
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="creatorName != null" >
+        #{creatorName,jdbcType=VARCHAR},
+      </if>
+      <if test="creatorId != null" >
+        #{creatorId,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null" >
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updaterName != null" >
+        #{updaterName,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.commons.po.Configs" >
+    update configs
+    <set >
+      <if test="code != null" >
+        code = #{code,jdbcType=VARCHAR},
+      </if>
+      <if test="description != null" >
+        description = #{description,jdbcType=VARCHAR},
+      </if>
+      <if test="data != null" >
+        data = #{data,jdbcType=VARCHAR},
+      </if>
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="creatorName != null" >
+        creatorName = #{creatorName,jdbcType=VARCHAR},
+      </if>
+      <if test="creatorId != null" >
+        creatorId = #{creatorId,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null" >
+        createTime = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updaterName != null" >
+        updaterName = #{updaterName,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.commons.po.Configs" >
+    update configs
+    set code = #{code,jdbcType=VARCHAR},
+    description = #{description,jdbcType=VARCHAR},
+    data = #{data,jdbcType=VARCHAR},
+    companyId = #{companyId,jdbcType=INTEGER},
+    creatorName = #{creatorName,jdbcType=VARCHAR},
+    creatorId = #{creatorId,jdbcType=INTEGER},
+    createTime = #{createTime,jdbcType=TIMESTAMP},
+    updaterName = #{updaterName,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectByCondition" resultMap="BaseResultMap">
+    select  *  from configs
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and  companyId = #{companyId}
+      </if>
+    </where>
+    order by id desc
+  </select>
+
+  <update id="updateCreator">
+    update configs set creatorId = #{userId} , creatorName=#{userName} where id=#{id}
+  </update>
+
+</mapper>

+ 1 - 4
applications/sale/sale-server/src/main/resources/mapper/SaleMapper.xml

@@ -44,10 +44,7 @@
     sa_seller,sa_sellercode,sa_date
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
-    select 
-    <include refid="Base_Column_List" />
-    from sale
-    where sa_id = #{id}
+    select * from sale where sa_id = #{id}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="long" >
     delete from sale

+ 1 - 1
frontend/saas-web/app/view/sale/sale/FormPanel.js

@@ -315,7 +315,7 @@ Ext.define('saas.view.sale.sale.FormPanel', {
         readOnly:true
      }, {
         xtype : "textfield", 
-        name : "sa_recorder", 
+        name : "creatorName", 
         fieldLabel : "录入人", 
         readOnly:true
     }, {