瀏覽代碼

币别汇率放大镜接口调整

chenw 7 年之前
父節點
當前提交
3db5fe46e3

+ 15 - 23
applications/document/document-dto/src/main/java/com.usoftchina.saas.document.dto/CurrencyDTO.java

@@ -10,39 +10,31 @@ import java.io.Serializable;
  */
 public class CurrencyDTO extends CommonBaseDTO implements Serializable {
 
-    private String name;
-    private Double rate;
-    private Long standard;
+    private String cr_name;
+    private Double cr_rate;
+    private Long cr_standard;
 
-    public Long getId() {
-        return id;
+    public String getCr_name() {
+        return cr_name;
     }
 
-    public void setId(Long id) {
-        this.id = id;
+    public void setCr_name(String cr_name) {
+        this.cr_name = cr_name;
     }
 
-    public String getName() {
-        return name;
+    public Double getCr_rate() {
+        return cr_rate;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setCr_rate(Double cr_rate) {
+        this.cr_rate = cr_rate;
     }
 
-    public Double getRate() {
-        return rate;
+    public Long getCr_standard() {
+        return cr_standard;
     }
 
-    public void setRate(Double rate) {
-        this.rate = rate;
-    }
-
-    public Long getStandard() {
-        return standard;
-    }
-
-    public void setStandard(Long standard) {
-        this.standard = standard;
+    public void setCr_standard(Long cr_standard) {
+        this.cr_standard = cr_standard;
     }
 }

+ 15 - 15
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Currency.java

@@ -10,31 +10,31 @@ import java.io.Serializable;
  */
 public class Currency extends CommonBaseEntity implements Serializable{
 
-    private String name;
-    private Double rate;
-    private Long standard;
+    private String cr_name;
+    private Double cr_rate;
+    private Long cr_standard;
 
-    public String getName() {
-        return name;
+    public String getCr_name() {
+        return cr_name;
     }
 
-    public void setName(String name) {
-        this.name = name;
+    public void setCr_name(String cr_name) {
+        this.cr_name = cr_name;
     }
 
-    public Double getRate() {
-        return rate;
+    public Double getCr_rate() {
+        return cr_rate;
     }
 
-    public void setRate(Double rate) {
-        this.rate = rate;
+    public void setCr_rate(Double cr_rate) {
+        this.cr_rate = cr_rate;
     }
 
-    public Long getStandard() {
-        return standard;
+    public Long getCr_standard() {
+        return cr_standard;
     }
 
-    public void setStandard(Long standard) {
-        this.standard = standard;
+    public void setCr_standard(Long cr_standard) {
+        this.cr_standard = cr_standard;
     }
 }

+ 7 - 2
applications/document/document-server/src/main/java/com/usoftchina/saas/document/controller/CurrencyController.java

@@ -1,10 +1,15 @@
 package com.usoftchina.saas.document.controller;
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.Result;
+import com.usoftchina.saas.commons.dto.DocReqDTO;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.CurrencyDTO;
 import com.usoftchina.saas.document.entities.Currency;
 import com.usoftchina.saas.document.service.CurrencyService;
+import com.usoftchina.saas.page.PageDefault;
+import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -23,8 +28,8 @@ public class CurrencyController {
     private CurrencyService currencyService;
 
     @GetMapping("/list")
-    public Result getAll(){
-        List<Currency> currencyList = currencyService.findByCompanyId(BaseContextHolder.getCompanyId());
+    public Result getAll(@PageDefault(number = 1, size = 10) PageRequest pageRequest, ListReqDTO listReqDTO){
+        PageInfo<Currency> currencyList = currencyService.getAll(pageRequest, listReqDTO);
         return Result.success(currencyList);
     }
 

+ 6 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/CurrencyMapper.java

@@ -2,6 +2,12 @@ package com.usoftchina.saas.document.mapper;
 
 import com.usoftchina.saas.base.mapper.CommonBaseMapper;
 import com.usoftchina.saas.document.entities.Currency;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface CurrencyMapper extends CommonBaseMapper<Currency> {
+
+    List<Currency> getAll(@Param("condition") String condition, @Param("companyId") Long companyId);
+
 }

+ 5 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/CurrencyService.java

@@ -1,12 +1,17 @@
 package com.usoftchina.saas.document.service;
 
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseService;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
 import com.usoftchina.saas.document.dto.CurrencyDTO;
 import com.usoftchina.saas.document.entities.Currency;
 import com.usoftchina.saas.document.mapper.CurrencyMapper;
+import com.usoftchina.saas.page.PageRequest;
 
 public interface CurrencyService  extends CommonBaseService<CurrencyMapper, Currency> {
 
     void save(CurrencyDTO currencyDTO);
 
+    PageInfo<Currency> getAll(PageRequest pageRequest, ListReqDTO listReqDTO);
+
 }

+ 16 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CurrencyServiceImpl.java

@@ -1,13 +1,20 @@
 package com.usoftchina.saas.document.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
+import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.dto.CurrencyDTO;
 import com.usoftchina.saas.document.entities.Currency;
 import com.usoftchina.saas.document.mapper.CurrencyMapper;
 import com.usoftchina.saas.document.service.CurrencyService;
+import com.usoftchina.saas.page.PageRequest;
 import com.usoftchina.saas.utils.BeanMapper;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @Author chenwei
  * @Date 2019/01/04
@@ -25,4 +32,13 @@ public class CurrencyServiceImpl extends CommonBaseServiceImpl<CurrencyMapper, C
             getMapper().updateByPrimaryKeySelective(currency);
         }
     }
+
+    @Override
+    public PageInfo<Currency> getAll(PageRequest pageRequest, ListReqDTO listReqDTO) {
+        String condition = listReqDTO.getFinalCondition();
+        PageHelper.startPage(pageRequest.getNumber(), pageRequest.getSize());
+        List<Currency> currencyList = getMapper().getAll(condition, BaseContextHolder.getCompanyId());
+        PageInfo<Currency> pageInfo = new PageInfo<Currency>(currencyList);
+        return pageInfo;
+    }
 }

+ 30 - 18
applications/document/document-server/src/main/resources/mapper/CurrencyMapper.xml

@@ -3,8 +3,8 @@
 <mapper namespace="com.usoftchina.saas.document.mapper.CurrencyMapper" >
     <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Currency" >
         <id column="cr_id" property="id" jdbcType="INTEGER" />
-        <result column="cr_name" property="name" jdbcType="VARCHAR" />
-        <result column="cr_rate" property="rate" jdbcType="VARCHAR" />
+        <result column="cr_name" property="cr_name" jdbcType="VARCHAR" />
+        <result column="cr_rate" property="cr_rate" jdbcType="VARCHAR" />
         <result column="companyId" property="companyId" jdbcType="INTEGER" />
         <result column="creatorId" property="creatorId" jdbcType="INTEGER" />
         <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
@@ -12,7 +12,7 @@
         <result column="creatorName" property="creatorName" jdbcType="INTEGER" />
         <result column="updaterName" property="updaterName" jdbcType="INTEGER" />
         <result column="createTime" property="createTime" jdbcType="TIMESTAMP" />
-        <result column="cr_standard" property="standard" jdbcType="INTEGER" />
+        <result column="cr_standard" property="cr_standard" jdbcType="INTEGER" />
     </resultMap>
     <sql id="Base_Column_List" >
         cr_id, cr_name, cr_rate, companyId, creatorId, updaterId, updateTime, creatorName, updaterName, createTime, cr_standard
@@ -30,13 +30,13 @@
     <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Currency" >
         insert into Currencys
         <trim prefix="(" suffix=")" suffixOverrides="," >
-            <if test="name != null" >
+            <if test="cr_name != null" >
                 cr_name,
             </if>
-            <if test="rate != null">
+            <if test="cr_rate != null">
                 cr_rate,
             </if>
-            <if test="standard != null">
+            <if test="cr_standard != null">
                 cr_standard,
             </if>
             <if test="companyId != null" >
@@ -59,14 +59,14 @@
             </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides="," >
-            <if test="name != null" >
-                #{name,jdbcType=VARCHAR},
+            <if test="cr_name != null" >
+                #{cr_name,jdbcType=VARCHAR},
             </if>
-            <if test="rate != null" >
-                #{rate,jdbcType=DOUBLE},
+            <if test="cr_rate != null" >
+                #{cr_rate,jdbcType=DOUBLE},
             </if>
-            <if test="standard != null" >
-                #{standard,jdbcType=INTEGER},
+            <if test="cr_standard != null" >
+                #{cr_standard,jdbcType=INTEGER},
             </if>
             <if test="companyId != null" >
                 #{companyId,jdbcType=INTEGER},
@@ -91,14 +91,14 @@
     <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Currency" >
         update Currencys
         <set >
-            <if test="name != null" >
-                cr_name = #{name,jdbcType=VARCHAR},
+            <if test="cr_name != null" >
+                cr_name = #{cr_name,jdbcType=VARCHAR},
             </if>
-            <if test="rate != null" >
-                cr_rate = #{rate,jdbcType=DOUBLE},
+            <if test="cr_rate != null" >
+                cr_rate = #{cr_rate,jdbcType=DOUBLE},
             </if>
-            <if test="standard != null" >
-                cr_standard = #{standard,jdbcType=INTEGER},
+            <if test="cr_standard != null" >
+                cr_standard = #{cr_standard,jdbcType=INTEGER},
             </if>
             <if test="companyId != null" >
                 companyId = #{companyId,jdbcType=INTEGER},
@@ -115,4 +115,16 @@
     <select id="selectByCompanyId" resultMap="BaseResultMap">
         SELECT * FROM Currencys where companyId=#{companyId} ORDER BY CR_ID DESC
     </select>
+    <select id="getAll" resultMap="BaseResultMap">
+      SELECT * FROM Currencys
+      <where>
+        <if test="condition != null">
+          ${condition}
+        </if>
+        <if test="companyId != null">
+          and companyId = #{companyId}
+        </if>
+      </where>
+      ORDER BY CR_ID DESC
+    </select>
 </mapper>