Browse Source

1.客户新增删除操作中间表,并更新金额

heqinwei 7 years ago
parent
commit
d2c3b6afdc

+ 195 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Banksubledger.java

@@ -0,0 +1,195 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author hx
+ * @createtime 2018-10-19 15:58
+ */
+@Data
+public class Banksubledger extends CommonBaseEntity implements Serializable {
+    private Integer bl_id;  //ID
+
+    private Integer bl_ym;  //期间
+
+    private Integer bl_bankid;  //账户ID
+
+    private String bl_bankcode; //账户编号
+
+    private String bl_bankname;  //账户名称
+
+    private String bl_code;     //单据编号
+ 
+    private String bl_kind;     //单据类型
+
+    private Date bl_date;      //单据日期
+
+    private String bl_asstype;   //往来类型
+
+    private String bl_asscode;    //往来单位编号
+
+    private String bl_assname;    //往来单位名称
+
+    private Double bl_income;    //收入
+
+    private Double bl_spending;   //支出
+
+    private String bl_manname;    //收/付款人
+ 
+    private String bl_remark;    //备注
+
+    private Double bl_orderamount;
+
+    private Integer bl_assid;
+
+    private String bl_item;
+
+    public Double getBl_orderamount() {
+        return bl_orderamount;
+    }
+
+    public void setBl_orderamount(Double bl_orderamount) {
+        this.bl_orderamount = bl_orderamount;
+    }
+
+    public Integer getBl_assid() {
+        return bl_assid;
+    }
+
+    public void setBl_assid(Integer bl_assid) {
+        this.bl_assid = bl_assid;
+    }
+
+    public String getBl_item() {
+        return bl_item;
+    }
+
+    public void setBl_item(String bl_item) {
+        this.bl_item = bl_item;
+    }
+
+    public Integer getBl_id() {
+        return bl_id;
+    }
+
+    public void setBl_id(Integer bl_id) {
+        this.bl_id = bl_id;
+    }
+
+    public Integer getBl_ym() {
+        return bl_ym;
+    }
+
+    public void setBl_ym(Integer bl_ym) {
+        this.bl_ym = bl_ym;
+    }
+
+    public Integer getBl_bankid() {
+        return bl_bankid;
+    }
+
+    public void setBl_bankid(Integer bl_bankid) {
+        this.bl_bankid = bl_bankid;
+    }
+
+    public String getBl_bankcode() {
+        return bl_bankcode;
+    }
+
+    public void setBl_bankcode(String bl_bankcode) {
+        this.bl_bankcode = bl_bankcode == null ? null : bl_bankcode.trim();
+    }
+
+    public String getBl_bankname() {
+        return bl_bankname;
+    }
+
+    public void setBl_bankname(String bl_bankname) {
+        this.bl_bankname = bl_bankname == null ? null : bl_bankname.trim();
+    }
+
+    public String getBl_code() {
+        return bl_code;
+    }
+
+    public void setBl_code(String bl_code) {
+        this.bl_code = bl_code == null ? null : bl_code.trim();
+    }
+
+    public String getBl_kind() {
+        return bl_kind;
+    }
+
+    public void setBl_kind(String bl_kind) {
+        this.bl_kind = bl_kind == null ? null : bl_kind.trim();
+    }
+
+    public Date getBl_date() {
+        return bl_date;
+    }
+
+    public void setBl_date(Date bl_date) {
+        this.bl_date = bl_date;
+    }
+
+    public String getBl_asstype() {
+        return bl_asstype;
+    }
+
+    public void setBl_asstype(String bl_asstype) {
+        this.bl_asstype = bl_asstype == null ? null : bl_asstype.trim();
+    }
+
+    public String getBl_asscode() {
+        return bl_asscode;
+    }
+
+    public void setBl_asscode(String bl_asscode) {
+        this.bl_asscode = bl_asscode == null ? null : bl_asscode.trim();
+    }
+
+    public String getBl_assname() {
+        return bl_assname;
+    }
+
+    public void setBl_assname(String bl_assname) {
+        this.bl_assname = bl_assname == null ? null : bl_assname.trim();
+    }
+
+    public Double getBl_income() {
+        return bl_income;
+    }
+
+    public void setBl_income(Double bl_income) {
+        this.bl_income = bl_income;
+    }
+
+    public Double getBl_spending() {
+        return bl_spending;
+    }
+
+    public void setBl_spending(Double bl_spending) {
+        this.bl_spending = bl_spending;
+    }
+
+    public String getBl_manname() {
+        return bl_manname;
+    }
+
+    public void setBl_manname(String bl_manname) {
+        this.bl_manname = bl_manname == null ? null : bl_manname.trim();
+    }
+
+    public String getBl_remark() {
+        return bl_remark;
+    }
+
+    public void setBl_remark(String bl_remark) {
+        this.bl_remark = bl_remark == null ? null : bl_remark.trim();
+    }
+
+}

+ 141 - 0
applications/document/document-dto/src/main/java/com/usoftchina/saas/document/entities/Subledger.java

@@ -0,0 +1,141 @@
+package com.usoftchina.saas.document.entities;
+
+import com.usoftchina.saas.base.entity.CommonBaseEntity;
+
+import java.io.Serializable;
+import java.util.Date;
+
+//中间表
+public class Subledger extends CommonBaseEntity implements Serializable {
+
+    private String sl_code;
+
+    private String sl_kind;
+
+    private Integer sl_custid;
+
+    private Integer sl_vendid;
+
+    private Date sl_date;
+
+    private Double sl_amount;
+
+    private Double sl_preamount;
+
+    private Double sl_yamount;
+
+    private Double sl_namount;
+
+    private String sl_remark;
+
+    private Double sl_orderamount;
+
+    private Double sl_discount;
+
+    private Integer sl_ym;
+
+    public String getSl_code() {
+        return sl_code;
+    }
+
+    public void setSl_code(String sl_code) {
+        this.sl_code = sl_code;
+    }
+
+    public String getSl_kind() {
+        return sl_kind;
+    }
+
+    public void setSl_kind(String sl_kind) {
+        this.sl_kind = sl_kind;
+    }
+
+    public Integer getSl_custid() {
+        return sl_custid;
+    }
+
+    public void setSl_custid(Integer sl_custid) {
+        this.sl_custid = sl_custid;
+    }
+
+    public Integer getSl_vendid() {
+        return sl_vendid;
+    }
+
+    public void setSl_vendid(Integer sl_vendid) {
+        this.sl_vendid = sl_vendid;
+    }
+
+    public Date getSl_date() {
+        return sl_date;
+    }
+
+    public void setSl_date(Date sl_date) {
+        this.sl_date = sl_date;
+    }
+
+    public Double getSl_amount() {
+        return sl_amount;
+    }
+
+    public void setSl_amount(Double sl_amount) {
+        this.sl_amount = sl_amount;
+    }
+
+    public Double getSl_preamount() {
+        return sl_preamount;
+    }
+
+    public void setSl_preamount(Double sl_preamount) {
+        this.sl_preamount = sl_preamount;
+    }
+
+    public Double getSl_yamount() {
+        return sl_yamount;
+    }
+
+    public void setSl_yamount(Double sl_yamount) {
+        this.sl_yamount = sl_yamount;
+    }
+
+    public Double getSl_namount() {
+        return sl_namount;
+    }
+
+    public void setSl_namount(Double sl_namount) {
+        this.sl_namount = sl_namount;
+    }
+
+    public String getSl_remark() {
+        return sl_remark;
+    }
+
+    public void setSl_remark(String sl_remark) {
+        this.sl_remark = sl_remark;
+    }
+
+
+    public Double getSl_orderamount() {
+        return sl_orderamount;
+    }
+
+    public void setSl_orderamount(Double sl_orderamount) {
+        this.sl_orderamount = sl_orderamount;
+    }
+
+    public Double getSl_discount() {
+        return sl_discount;
+    }
+
+    public void setSl_discount(Double sl_discount) {
+        this.sl_discount = sl_discount;
+    }
+
+    public Integer getSl_ym() {
+        return sl_ym;
+    }
+
+    public void setSl_ym(Integer sl_ym) {
+        this.sl_ym = sl_ym;
+    }
+}

+ 1 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BankinformationMapper.java

@@ -23,5 +23,6 @@ public interface BankinformationMapper extends CommonBaseMapper<Bankinformation>
     List<Bankinformation> selectBankinformationBycondition(@Param("con") String con, @Param("companyId") Long companyId);
 
     List<ComboDTO> getCombo(@Param("companyId") Long companyId);
+    String selectBankcode(String bk_bankcode);
 
 }

+ 33 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/BanksubledgerMapper.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.document.mapper;
+
+
+import com.usoftchina.saas.base.mapper.CommonBaseMapper;
+import com.usoftchina.saas.document.entities.Banksubledger;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author hx
+ * @createtime 2018-10-19 15:57
+ */
+public interface BanksubledgerMapper extends CommonBaseMapper<Banksubledger> {
+
+    int deleteByPrimaryKey(@Param("code") String code, @Param("kind") String kind);
+    void deleteByBankid(Integer bk_id);
+
+//    Long insert(Banksubledger record);
+
+    int insertSelective(Banksubledger record);
+    List<String> selectCode(String code);
+
+    Banksubledger selectByPrimaryKey(Integer bl_id);
+
+    int updateByPrimaryKeySelective(Banksubledger record);
+
+    int updateByPrimaryKey(Banksubledger record);
+
+    int updateBankcode(@Param("bk_thisamount") Double bk_thisamount, @Param("nowbalance") Double nowbalance,
+                       @Param("bankcode") String bankcode, @Param("symbol") String symbol);
+    Double selectThisamount(String bankcode);
+}

+ 33 - 0
applications/document/document-server/src/main/java/com/usoftchina/saas/document/mapper/SubledgerMapper.java

@@ -0,0 +1,33 @@
+package com.usoftchina.saas.document.mapper;
+
+import com.usoftchina.saas.document.entities.Subledger;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author heqw
+ * @date 2018/11/6 10:33
+ **/
+public interface SubledgerMapper {
+    int deleteByPrimaryKey(@Param("code") String code, @Param("kind") String kind);
+
+    int insert(Subledger record);
+
+    int insertSelective(Subledger record);
+
+    Subledger selectByPrimaryKey(Integer sl_id);
+    String selectCode(String code);
+
+    int updateByPrimaryKeySelective(Subledger record);
+
+    int updateByPrimaryKey(Subledger record);
+
+    List<Subledger> selectSubledgerBycondition(@Param("con") String con, @Param("companyId") Long companyId);
+
+    Subledger selectByKindCodeCustid(@Param("sl_code") String sl_code, @Param("sl_kind") String sl_kind,
+                                     @Param("sl_custid") Integer sl_custid);
+
+    void deleteCustomer(@Param("sl_code") String sl_code, @Param("sl_kind") String sl_kind,
+                        @Param("sl_custid") Integer sl_custid);
+}

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

@@ -5,15 +5,23 @@ import com.github.pagehelper.PageInfo;
 import com.usoftchina.saas.base.service.CommonBaseServiceImpl;
 import com.usoftchina.saas.commons.dto.ComboDTO;
 import com.usoftchina.saas.commons.dto.ListReqDTO;
+import com.usoftchina.saas.commons.exception.BizExceptionCode;
 import com.usoftchina.saas.context.BaseContextHolder;
 import com.usoftchina.saas.document.entities.Bankinformation;
+import com.usoftchina.saas.document.entities.Banksubledger;
 import com.usoftchina.saas.document.mapper.BankinformationMapper;
+import com.usoftchina.saas.document.mapper.BanksubledgerMapper;
 import com.usoftchina.saas.document.service.BankinformationService;
+import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -24,24 +32,63 @@ import java.util.List;
 public class BankinformationServiceImpl extends CommonBaseServiceImpl<BankinformationMapper, Bankinformation> implements BankinformationService {
     @Autowired
     private BankinformationMapper bankinformationMapper;
+    @Autowired
+    private BanksubledgerMapper banksubledgerMapper;
 
+    @Transactional
     @Override
     public boolean save(Bankinformation bankinformation){
         bankinformation.setCompanyId(BaseContextHolder.getCompanyId());
         if (bankinformation.getBk_thisamount() == null || bankinformation.getBk_thisamount() == 0){
             bankinformation.setBk_thisamount(bankinformation.getBk_beginamount());
         }
+
+        //判断编号
+        String bktion = bankinformationMapper.selectBankcode(bankinformation.getBk_bankcode());
+        if (bktion != null){
+            throw new BizException(500, BizExceptionCode.ACCOUNT_EXISTS.getMessage());
+        }
+
+        //中间表
+        Banksubledger banksubledger = new Banksubledger();
+        Date date = bankinformation.getBk_date();
+        String dateString = date2String(date, "yyyyMMdd");
+        int ym = Integer.parseInt(dateString);
+
+        String date1 = date2String(date, "yyyymm");
+        date1 = date1 + "01 00:00:00";
+        Date d = null;
+        try {
+            d = string2Date(date1, "yyyy-mm-dd hh:mm:ss");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        banksubledger.setCompanyId(BaseContextHolder.getCompanyId());
+        banksubledger.setBl_ym(ym);
+        banksubledger.setBl_bankid(Math.toIntExact(bankinformation.getId()));
+        banksubledger.setBl_bankcode(bankinformation.getBk_bankcode());
+        banksubledger.setBl_bankname(bankinformation.getBk_bankname());
+        banksubledger.setBl_code("期初余额");
+        banksubledger.setBl_kind("期初余额");
+        banksubledger.setBl_date(d);
+        banksubledger.setBl_orderamount(bankinformation.getBk_beginamount());
+
         if(bankinformation.getId() == 0){
             bankinformationMapper.insertSelective(bankinformation);
+            banksubledgerMapper.insertSelective(banksubledger);
         }else{
             bankinformationMapper.updateByPrimaryKeySelective(bankinformation);
+            banksubledgerMapper.updateByPrimaryKeySelective(banksubledger);
         }
         return true;
     }
 
+    @Transactional
     @Override
     public boolean removeByPrimaryKey(int id){
         bankinformationMapper.deleteByPrimaryKey(id);
+        banksubledgerMapper.deleteByBankid(id);
         return true;
     }
 
@@ -78,4 +125,37 @@ public class BankinformationServiceImpl extends CommonBaseServiceImpl<Bankinform
     public List<ComboDTO> getCombo() {
         return getMapper().getCombo(BaseContextHolder.getCompanyId());
     }
+
+
+    /**
+     * String转Date类型
+     *
+     * @param dateStr
+     *            时间字符串
+     * @return Date类型时间
+     * @throws Exception
+     *             异常
+     */
+    public static Date string2Date(String dateStr, String format) throws Exception {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        if (dateStr == null) {
+            return sdf.parse(dateStr);
+        }
+        return null;
+    }
+
+    /**
+     * Date转String
+     *
+     * @param date
+     *            Date类型时间
+     * @return 时间字符串
+     */
+    public static String date2String(Date date, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        if (date != null) {
+            return sdf.format(date);
+        }
+        return null;
+    }
 }

+ 82 - 8
applications/document/document-server/src/main/java/com/usoftchina/saas/document/service/impl/CustomerServiceImpl.java

@@ -16,14 +16,8 @@ import com.usoftchina.saas.document.dto.CustomerDTO;
 import com.usoftchina.saas.document.dto.CustomerFormDTO;
 import com.usoftchina.saas.document.dto.CustomeraddressDTO;
 import com.usoftchina.saas.document.dto.CustomercontactDTO;
-import com.usoftchina.saas.document.entities.Customer;
-import com.usoftchina.saas.document.entities.CustomerList;
-import com.usoftchina.saas.document.entities.Customeraddress;
-import com.usoftchina.saas.document.entities.Customercontact;
-import com.usoftchina.saas.document.mapper.CustomerListMapper;
-import com.usoftchina.saas.document.mapper.CustomerMapper;
-import com.usoftchina.saas.document.mapper.CustomeraddressMapper;
-import com.usoftchina.saas.document.mapper.CustomercontactMapper;
+import com.usoftchina.saas.document.entities.*;
+import com.usoftchina.saas.document.mapper.*;
 import com.usoftchina.saas.document.service.CustomerService;
 import com.usoftchina.saas.exception.BizException;
 import com.usoftchina.saas.page.PageRequest;
@@ -33,6 +27,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -58,6 +53,8 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
 
     @Autowired
     private MaxnumberService maxnumberService;
+    @Autowired
+    private SubledgerMapper subledgerMapper;
 
 
     @Override
@@ -192,6 +189,14 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             customer.setCu_beginprerecamount(cutpl.getCu_beginprerecamount());
         }
 
+        //更新应收余额
+        Customer customer1 = getMapper().selectByPrimaryKey(cu_id);
+        Double cu_leftamount = (customer1.getCu_beginaramount() == null ? new Double(0) :  customer1.getCu_beginaramount())-
+                (customer1.getCu_beginprerecamount() == null ? new Double(0) : customer1.getCu_beginprerecamount()) +
+                (customer1.getCu_recamount() == null ? new Double(0) : customer1.getCu_recamount()) -
+                (customer1.getCu_preamount() == null ? new Double(0) : customer1.getCu_preamount());
+        customer.setCu_leftamount(cu_leftamount);
+
         //更新操作
         getMapper().updateByPrimaryKeySelective(customer);
         //添加从表传输对象
@@ -238,6 +243,41 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             customeraddressMapper.batchUpdate(updateDetail2);
         }
 
+        //插入中间表
+        Double amount = (customer.getCu_beginaramount() == null ? new Double(0) : customer.getCu_beginaramount())
+                - (customer.getCu_beginprerecamount() == null ? new Double(0) : customer.getCu_beginprerecamount());
+        if (amount != new Double(0)){
+            Subledger subledger = new Subledger();
+            subledger.setSl_code("期初余额");
+            subledger.setSl_kind("期初余额");
+            subledger.setSl_vendid(0);
+            subledger.setSl_custid(Math.toIntExact(customer.getId()));
+            subledger.setCompanyId(BaseContextHolder.getCompanyId());
+            String dates = date2String(customer.getCu_begindate(), "yyyy-mm");
+            dates = dates + "-01";
+            Date date = null;
+            try {
+                date = string2Date(dates, "yyyy-mm-dd");
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            subledger.setSl_date(date);
+            if (amount > new Double(0)){
+                subledger.setSl_amount(amount);
+            }else {
+                subledger.setSl_preamount(amount);
+            }
+            subledger.setSl_orderamount(Math.abs(amount));
+            subledger.setSl_namount(amount);
+
+            Subledger subledger1 = subledgerMapper.selectByKindCodeCustid("期初余额","期初余额",
+                    Math.toIntExact(customer.getId()));
+            if (subledger1 == null) {
+                subledgerMapper.insertSelective(subledger);
+            }else {
+                subledgerMapper.updateByPrimaryKeySelective(subledger);
+            }
+        }
 
         baseDTO = getBaseDTOById(cu_id);
         //日志记录
@@ -259,6 +299,10 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
             //从表删除
             customercontactMapper.deleteByFK(id);
             customeraddressMapper.deleteByFK(id);
+
+            //删除中间表
+            subledgerMapper.deleteCustomer("期初余额", "期初余额", Math.toIntExact(id));
+
             //日志
             messageLogService.delete(docBaseDTO);
         }
@@ -422,6 +466,36 @@ public class CustomerServiceImpl extends CommonBaseServiceImpl<CustomerMapper, C
         return maxnumberService.pushMaxnubmer(count, code, BillCodeSeq.CUSTOMER.getCaller()).getData();
     }
 
+    /**
+     * String转Date类型
+     *
+     * @param dateStr
+     *            时间字符串
+     * @return Date类型时间
+     * @throws Exception
+     *             异常
+     */
+    public static Date string2Date(String dateStr, String format) throws Exception {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        if (dateStr == null) {
+            return sdf.parse(dateStr);
+        }
+        return null;
+    }
 
+    /**
+     * Date转String
+     *
+     * @param date
+     *            Date类型时间
+     * @return 时间字符串
+     */
+    public static String date2String(Date date, String format) {
+        SimpleDateFormat sdf = new SimpleDateFormat(format);
+        if (date != null) {
+            return sdf.format(date);
+        }
+        return null;
+    }
 
 }

+ 5 - 0
applications/document/document-server/src/main/resources/mapper/BankinformationMapper.xml

@@ -314,4 +314,9 @@
   <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
         SELECT CONCAT(bk_bankcode,' ',bk_bankname) display,bk_bankname value FROM bankinformation WHERE COMPANYID=#{companyId}
     </select>
+
+
+  <select id="selectBankcode" parameterType="java.lang.String" resultType="java.lang.String">
+        select bk_bankcode from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR}
+    </select>
 </mapper>

+ 345 - 0
applications/document/document-server/src/main/resources/mapper/BanksubledgerMapper.xml

@@ -0,0 +1,345 @@
+<?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.document.mapper.BanksubledgerMapper">
+    <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Banksubledger">
+        <id column="bl_id" jdbcType="INTEGER" property="id" />
+        <result column="bl_ym" jdbcType="INTEGER" property="bl_ym" />
+        <result column="bl_bankid" jdbcType="INTEGER" property="bl_bankid" />
+        <result column="bl_bankcode" jdbcType="VARCHAR" property="bl_bankcode" />
+        <result column="bl_bankname" jdbcType="VARCHAR" property="bl_bankname" />
+        <result column="bl_code" jdbcType="VARCHAR" property="bl_code" />
+        <result column="bl_kind" jdbcType="VARCHAR" property="bl_kind" />
+        <result column="bl_date" jdbcType="TIMESTAMP" property="bl_date" />
+        <result column="bl_asstype" jdbcType="VARCHAR" property="bl_asstype" />
+        <result column="bl_asscode" jdbcType="VARCHAR" property="bl_asscode" />
+        <result column="bl_assname" jdbcType="VARCHAR" property="bl_assname" />
+        <result column="bl_income" jdbcType="DOUBLE" property="bl_income" />
+        <result column="bl_spending" jdbcType="DOUBLE" property="bl_spending" />
+        <result column="bl_manname" jdbcType="VARCHAR" property="bl_manname" />
+        <result column="bl_remark" jdbcType="VARCHAR" property="bl_remark" />
+        <result column="companyId" jdbcType="INTEGER" property="companyId" />
+        <result column="updaterId" jdbcType="INTEGER" property="updaterId" />
+        <result column="updatedate" jdbcType="TIMESTAMP" property="updatedate" />
+        <result column="bl_orderamount" property="bl_orderamount" jdbcType="DOUBLE" />
+        <result column="bl_assid" property="bl_assid" jdbcType="INTEGER" />
+        <result column="bl_item" property="bl_item" jdbcType="VARCHAR" />
+    </resultMap>
+    <sql id="Example_Where_Clause">
+        <where>
+            <foreach collection="oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                                        #{listItem}
+                                    </foreach>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
+            </foreach>
+        </where>
+    </sql>
+    <sql id="Update_By_Example_Where_Clause">
+        <where>
+            <foreach collection="example.oredCriteria" item="criteria" separator="or">
+                <if test="criteria.valid">
+                    <trim prefix="(" prefixOverrides="and" suffix=")">
+                        <foreach collection="criteria.criteria" item="criterion">
+                            <choose>
+                                <when test="criterion.noValue">
+                                    and ${criterion.condition}
+                                </when>
+                                <when test="criterion.singleValue">
+                                    and ${criterion.condition} #{criterion.value}
+                                </when>
+                                <when test="criterion.betweenValue">
+                                    and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                                </when>
+                                <when test="criterion.listValue">
+                                    and ${criterion.condition}
+                                    <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                                        #{listItem}
+                                    </foreach>
+                                </when>
+                            </choose>
+                        </foreach>
+                    </trim>
+                </if>
+            </foreach>
+        </where>
+    </sql>
+    <sql id="Base_Column_List">
+    bl_id, bl_ym, bl_bankid, bl_bankcode, bl_bankname, bl_code, bl_kind, bl_date, bl_asstype, 
+    bl_asscode, bl_assname, bl_income, bl_spending, bl_manname, bl_remark, companyId, 
+    updaterId, updatedate, bl_orderamount, bl_assid, bl_item
+  </sql>
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from banksubledger
+        where bl_id = #{bl_id,jdbcType=INTEGER}
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from banksubledger
+    where bl_id = #{code,jdbcType=VARCHAR} and bl_kind = #{kind, jdbcType=VARCHAR}
+  </delete>
+
+    <delete id="deleteByBankid" parameterType="java.lang.Integer">
+    delete from banksubledger
+    where bl_id = #{bk_id,jdbcType=INTEGER}
+  </delete>
+
+    <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Banksubledger">
+    insert into banksubledger (bl_id, bl_ym, bl_bankid, 
+      bl_bankcode, bl_bankname, bl_code, 
+      bl_kind, bl_date, bl_asstype, 
+      bl_asscode, bl_assname, bl_income, 
+      bl_spending, bl_manname, bl_remark, 
+      companyId, updaterId, updatedate
+      )
+    values (#{bl_id,jdbcType=INTEGER}, #{bl_ym,jdbcType=INTEGER}, #{bl_bankid,jdbcType=INTEGER}, 
+      #{bl_bankcode,jdbcType=VARCHAR}, #{bl_bankname,jdbcType=VARCHAR}, #{bl_code,jdbcType=VARCHAR}, 
+      #{bl_kind,jdbcType=VARCHAR}, #{bl_date,jdbcType=TIMESTAMP}, #{bl_asstype,jdbcType=VARCHAR}, 
+      #{bl_asscode,jdbcType=VARCHAR}, #{bl_assname,jdbcType=VARCHAR}, #{bl_income,jdbcType=DOUBLE}, 
+      #{bl_spending,jdbcType=DOUBLE}, #{bl_manname,jdbcType=VARCHAR}, #{bl_remark,jdbcType=VARCHAR}, 
+      #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER}, #{updatedate,jdbcType=TIMESTAMP}
+      )
+  </insert>
+    <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Banksubledger">
+        insert into banksubledger
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="bl_ym != null">
+                bl_ym,
+            </if>
+            <if test="bl_bankid != null">
+                bl_bankid,
+            </if>
+            <if test="bl_bankcode != null">
+                bl_bankcode,
+            </if>
+            <if test="bl_bankname != null">
+                bl_bankname,
+            </if>
+            <if test="bl_code != null">
+                bl_code,
+            </if>
+            <if test="bl_kind != null">
+                bl_kind,
+            </if>
+            <if test="bl_date != null">
+                bl_date,
+            </if>
+            <if test="bl_asstype != null">
+                bl_asstype,
+            </if>
+            <if test="bl_asscode != null">
+                bl_asscode,
+            </if>
+            <if test="bl_assname != null">
+                bl_assname,
+            </if>
+            <if test="bl_income != null">
+                bl_income,
+            </if>
+            <if test="bl_spending != null">
+                bl_spending,
+            </if>
+            <if test="bl_manname != null">
+                bl_manname,
+            </if>
+            <if test="bl_remark != null">
+                bl_remark,
+            </if>
+            <if test="companyId != null">
+                companyId,
+            </if>
+            <if test="updaterId != null">
+                updaterId,
+            </if>
+            <if test="updateTime != null">
+                updatedate,
+            </if>
+            <if test="bl_orderamount != null" >
+                bl_orderamount,
+            </if>
+            <if test="bl_assid != null" >
+                bl_assid,
+            </if>
+            <if test="bl_item != null" >
+                bl_item,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="bl_ym != null">
+                #{bl_ym,jdbcType=INTEGER},
+            </if>
+            <if test="bl_bankid != null">
+                #{bl_bankid,jdbcType=INTEGER},
+            </if>
+            <if test="bl_bankcode != null">
+                #{bl_bankcode,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_bankname != null">
+                #{bl_bankname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_code != null">
+                #{bl_code,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_kind != null">
+                #{bl_kind,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_date != null">
+                #{bl_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="bl_asstype != null">
+                #{bl_asstype,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_asscode != null">
+                #{bl_asscode,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_assname != null">
+                #{bl_assname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_income != null">
+                #{bl_income,jdbcType=DOUBLE},
+            </if>
+            <if test="bl_spending != null">
+                #{bl_spending,jdbcType=DOUBLE},
+            </if>
+            <if test="bl_manname != null">
+                #{bl_manname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_remark != null">
+                #{bl_remark,jdbcType=VARCHAR},
+            </if>
+            <if test="companyId != null">
+                #{companyId,jdbcType=INTEGER},
+            </if>
+            <if test="updaterId != null">
+                #{updaterId,jdbcType=INTEGER},
+            </if>
+            <if test="updateTime != null">
+                #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="bl_orderamount != null" >
+                #{bl_orderamount,jdbcType=DOUBLE},
+            </if>
+            <if test="bl_assid != null" >
+                #{bl_assid,jdbcType=INTEGER},
+            </if>
+            <if test="bl_item != null" >
+                #{bl_item,jdbcType=VARCHAR},
+            </if>
+        </trim>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Banksubledger">
+        update banksubledger
+        <set>
+            <if test="bl_ym != null">
+                bl_ym = #{bl_ym,jdbcType=INTEGER},
+            </if>
+            <if test="bl_bankid != null">
+                bl_bankid = #{bl_bankid,jdbcType=INTEGER},
+            </if>
+            <if test="bl_bankcode != null">
+                bl_bankcode = #{bl_bankcode,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_bankname != null">
+                bl_bankname = #{bl_bankname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_code != null">
+                bl_code = #{bl_code,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_kind != null">
+                bl_kind = #{bl_kind,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_date != null">
+                bl_date = #{bl_date,jdbcType=TIMESTAMP},
+            </if>
+            <if test="bl_asstype != null">
+                bl_asstype = #{bl_asstype,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_asscode != null">
+                bl_asscode = #{bl_asscode,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_assname != null">
+                bl_assname = #{bl_assname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_income != null">
+                bl_income = #{bl_income,jdbcType=DOUBLE},
+            </if>
+            <if test="bl_spending != null">
+                bl_spending = #{bl_spending,jdbcType=DOUBLE},
+            </if>
+            <if test="bl_manname != null">
+                bl_manname = #{bl_manname,jdbcType=VARCHAR},
+            </if>
+            <if test="bl_remark != null">
+                bl_remark = #{bl_remark,jdbcType=VARCHAR},
+            </if>
+            <if test="companyId != null">
+                companyId = #{companyId,jdbcType=INTEGER},
+            </if>
+            <if test="updaterId != null">
+                updaterId = #{updaterId,jdbcType=INTEGER},
+            </if>
+            <if test="updateTime != null">
+                updatedate = #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+        </set>
+        where bl_id = #{id,jdbcType=INTEGER}
+    </update>
+    <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Banksubledger">
+    update banksubledger
+    set bl_ym = #{bl_ym,jdbcType=INTEGER},
+      bl_bankid = #{bl_bankid,jdbcType=INTEGER},
+      bl_bankcode = #{bl_bankcode,jdbcType=VARCHAR},
+      bl_bankname = #{bl_bankname,jdbcType=VARCHAR},
+      bl_code = #{bl_code,jdbcType=VARCHAR},
+      bl_kind = #{bl_kind,jdbcType=VARCHAR},
+      bl_date = #{bl_date,jdbcType=TIMESTAMP},
+      bl_asstype = #{bl_asstype,jdbcType=VARCHAR},
+      bl_asscode = #{bl_asscode,jdbcType=VARCHAR},
+      bl_assname = #{bl_assname,jdbcType=VARCHAR},
+      bl_income = #{bl_income,jdbcType=DOUBLE},
+      bl_spending = #{bl_spending,jdbcType=DOUBLE},
+      bl_manname = #{bl_manname,jdbcType=VARCHAR},
+      bl_remark = #{bl_remark,jdbcType=VARCHAR},
+      companyId = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updatedate = #{updatedate,jdbcType=TIMESTAMP}
+    where bl_id = #{bl_id,jdbcType=INTEGER}
+  </update>
+    <select id="selectCode" parameterType="java.lang.String" resultType="java.lang.String">
+        select bl_code
+        from banksubledger
+        where bl_code = #{bl_code,jdbcType=VARCHAR}
+    </select>
+
+    <update id="updateBankcode">
+    update bankinformation
+    set bk_thisamount = (IFNULL(#{bk_thisamount,jdbcType=DOUBLE},0) ${symbol} #{nowbalance})
+    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
+  </update>
+
+    <select id="selectThisamount" resultType="java.lang.Double" parameterType="java.lang.String">
+   select bk_thisamount from bankinformation
+    where bk_bankcode = #{bankcode,jdbcType=VARCHAR}
+  </select>
+
+</mapper>

+ 263 - 0
applications/document/document-server/src/main/resources/mapper/SubledgerMapper.xml

@@ -0,0 +1,263 @@
+<?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.document.mapper.SubledgerMapper" >
+  <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Subledger" >
+    <id column="sl_id" property="id" jdbcType="INTEGER" />
+    <result column="sl_code" property="sl_code" jdbcType="VARCHAR" />
+    <result column="sl_kind" property="sl_kind" jdbcType="VARCHAR" />
+    <result column="sl_custid" property="sl_custid" jdbcType="INTEGER" />
+    <result column="sl_vendid" property="sl_vendid" jdbcType="INTEGER" />
+    <result column="sl_date" property="sl_date" jdbcType="TIMESTAMP" />
+    <result column="sl_amount" property="sl_amount" jdbcType="DOUBLE" />
+    <result column="sl_preamount" property="sl_preamount" jdbcType="DOUBLE" />
+    <result column="sl_yamount" property="sl_yamount" jdbcType="DOUBLE" />
+    <result column="sl_namount" property="sl_namount" jdbcType="DOUBLE" />
+    <result column="sl_remark" property="sl_remark" jdbcType="VARCHAR" />
+    <result column="companyId" property="companyId" jdbcType="INTEGER" />
+    <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
+    <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
+    <result column="sl_orderamount" property="sl_orderamount" jdbcType="DOUBLE" />
+    <result column="sl_discount" property="sl_discount" jdbcType="DOUBLE" />
+    <result column="sl_ym" property="sl_ym" jdbcType="INTEGER" />
+  </resultMap>
+  <sql id="Base_Column_List" >
+    sl_id, sl_code, sl_kind, sl_custid, sl_vendid, sl_date, sl_amount, sl_preamount, 
+    sl_yamount, sl_namount, sl_remark, companyId, updaterId, updateTime, sl_orderamount, 
+    sl_discount, sl_ym
+  </sql>
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
+    select 
+    <include refid="Base_Column_List" />
+    from subledger
+    where sl_id = #{sl_id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
+    delete from subledger
+    where sl_code = #{code,jdbcType=VARCHAR} and sl_kind = #{kind, jdbcType=VARCHAR}
+  </delete>
+  <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Subledger" >
+    insert into subledger (sl_id, sl_code, sl_kind, 
+      sl_custid, sl_vendid, sl_date, 
+      sl_amount, sl_preamount, sl_yamount, 
+      sl_namount, sl_remark, companyId, 
+      updaterId, updateTime, sl_orderamount, 
+      sl_discount, sl_ym)
+    values (#{sl_id,jdbcType=INTEGER}, #{sl_code,jdbcType=VARCHAR}, #{sl_kind,jdbcType=VARCHAR}, 
+      #{sl_custid,jdbcType=INTEGER}, #{sl_vendid,jdbcType=INTEGER}, #{sl_date,jdbcType=TIMESTAMP}, 
+      #{sl_amount,jdbcType=DOUBLE}, #{sl_preamount,jdbcType=DOUBLE}, #{sl_yamount,jdbcType=DOUBLE}, 
+      #{sl_namount,jdbcType=DOUBLE}, #{sl_remark,jdbcType=VARCHAR}, #{companyId,jdbcType=INTEGER}, 
+      #{updaterId,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{sl_orderamount,jdbcType=DOUBLE}, 
+      #{sl_discount,jdbcType=DOUBLE}, #{sl_ym,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Subledger" >
+    insert into subledger
+    <trim prefix="(" suffix=")" suffixOverrides="," >
+      <if test="sl_code != null" >
+        sl_code,
+      </if>
+      <if test="sl_kind != null" >
+        sl_kind,
+      </if>
+      <if test="sl_custid != null" >
+        sl_custid,
+      </if>
+      <if test="sl_vendid != null" >
+        sl_vendid,
+      </if>
+      <if test="sl_date != null" >
+        sl_date,
+      </if>
+      <if test="sl_amount != null" >
+        sl_amount,
+      </if>
+      <if test="sl_preamount != null" >
+        sl_preamount,
+      </if>
+      <if test="sl_yamount != null" >
+        sl_yamount,
+      </if>
+      <if test="sl_namount != null" >
+        sl_namount,
+      </if>
+      <if test="sl_remark != null" >
+        sl_remark,
+      </if>
+      <if test="companyId != null" >
+        companyId,
+      </if>
+      <if test="updaterId != null" >
+        updaterId,
+      </if>
+      <if test="updateTime != null" >
+        updateTime,
+      </if>
+      <if test="sl_orderamount != null" >
+        sl_orderamount,
+      </if>
+      <if test="sl_discount != null" >
+        sl_discount,
+      </if>
+      <if test="sl_ym != null" >
+        sl_ym,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
+      <if test="sl_code != null" >
+        #{sl_code,jdbcType=VARCHAR},
+      </if>
+      <if test="sl_kind != null" >
+        #{sl_kind,jdbcType=VARCHAR},
+      </if>
+      <if test="sl_custid != null" >
+        #{sl_custid,jdbcType=INTEGER},
+      </if>
+      <if test="sl_vendid != null" >
+        #{sl_vendid,jdbcType=INTEGER},
+      </if>
+      <if test="sl_date != null" >
+        #{sl_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="sl_amount != null" >
+        #{sl_amount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_preamount != null" >
+        #{sl_preamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_yamount != null" >
+        #{sl_yamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_namount != null" >
+        #{sl_namount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_remark != null" >
+        #{sl_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyId != null" >
+        #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="sl_orderamount != null" >
+        #{sl_orderamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_discount != null" >
+        #{sl_discount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_ym != null" >
+        #{sl_ym,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Subledger" >
+    update subledger
+    <set >
+      <if test="sl_code != null" >
+        sl_code = #{sl_code,jdbcType=VARCHAR},
+      </if>
+      <if test="sl_kind != null" >
+        sl_kind = #{sl_kind,jdbcType=VARCHAR},
+      </if>
+      <if test="sl_custid != null" >
+        sl_custid = #{sl_custid,jdbcType=INTEGER},
+      </if>
+      <if test="sl_vendid != null" >
+        sl_vendid = #{sl_vendid,jdbcType=INTEGER},
+      </if>
+      <if test="sl_date != null" >
+        sl_date = #{sl_date,jdbcType=TIMESTAMP},
+      </if>
+      <if test="sl_amount != null" >
+        sl_amount = #{sl_amount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_preamount != null" >
+        sl_preamount = #{sl_preamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_yamount != null" >
+        sl_yamount = #{sl_yamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_namount != null" >
+        sl_namount = #{sl_namount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_remark != null" >
+        sl_remark = #{sl_remark,jdbcType=VARCHAR},
+      </if>
+      <if test="companyId != null" >
+        companyId = #{companyId,jdbcType=INTEGER},
+      </if>
+      <if test="updaterId != null" >
+        updaterId = #{updaterId,jdbcType=INTEGER},
+      </if>
+      <if test="updateTime != null" >
+        updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="sl_orderamount != null" >
+        sl_orderamount = #{sl_orderamount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_discount != null" >
+        sl_discount = #{sl_discount,jdbcType=DOUBLE},
+      </if>
+      <if test="sl_ym != null" >
+        sl_ym = #{sl_ym,jdbcType=INTEGER},
+      </if>
+    </set>
+    where sl_id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoftchina.saas.document.entities.Subledger" >
+    update subledger
+    set sl_code = #{sl_code,jdbcType=VARCHAR},
+      sl_kind = #{sl_kind,jdbcType=VARCHAR},
+      sl_custid = #{sl_custid,jdbcType=INTEGER},
+      sl_vendid = #{sl_vendid,jdbcType=INTEGER},
+      sl_date = #{sl_date,jdbcType=TIMESTAMP},
+      sl_amount = #{sl_amount,jdbcType=DOUBLE},
+      sl_preamount = #{sl_preamount,jdbcType=DOUBLE},
+      sl_yamount = #{sl_yamount,jdbcType=DOUBLE},
+      sl_namount = #{sl_namount,jdbcType=DOUBLE},
+      sl_remark = #{sl_remark,jdbcType=VARCHAR},
+      companyId = #{companyId,jdbcType=INTEGER},
+      updaterId = #{updaterId,jdbcType=INTEGER},
+      updateTime = #{updateTime,jdbcType=TIMESTAMP},
+      sl_orderamount = #{sl_orderamount,jdbcType=DOUBLE},
+      sl_discount = #{sl_discount,jdbcType=DOUBLE},
+      sl_ym = #{sl_ym,jdbcType=INTEGER}
+    where sl_id = #{sl_id,jdbcType=INTEGER}
+  </update>
+
+  <select id="selectSubledgerBycondition" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from subledger
+    <where>
+      <if test="con != null">
+        ${con}
+      </if>
+      <if test="companyId != null">
+        and   subledger.companyId = #{companyId}
+      </if>
+    </where>  order by sl_date desc
+  </select>
+
+  <select id="selectCode" parameterType="java.lang.String" resultMap="BaseResultMap">
+        select sl_code
+        from subledger
+        where sl_code = #{sl_code,jdbcType=VARCHAR}
+    </select>
+
+  <select id="selectByKindCodeCustid" resultMap="BaseResultMap">
+  select
+  <include refid="Base_Column_List" />
+  from subledger
+  where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind,jdbcType=VARCHAR} and
+    sl_custid = #{sl_custid,jdbcType=INTEGER}
+  </select>
+
+  <delete id="deleteCustomer">
+    delete from subledger
+    where sl_code = #{sl_code,jdbcType=VARCHAR} and sl_kind = #{sl_kind, jdbcType=VARCHAR} and
+    sl_custid = #{sl_custid,jdbcType=INTEGER}
+  </delete>
+</mapper>