Procházet zdrojové kódy

新增合同开票情况表,按选择字段导出合同表

lamphua před 1 měsícem
rodič
revize
10c6be1a42

+ 35
- 15
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractController.java Zobrazit soubor

@@ -1,19 +1,19 @@
1 1
 package com.ruoyi.web.controller.oa;
2 2
 
3 3
 import java.math.BigDecimal;
4
+import java.math.RoundingMode;
4 5
 import java.text.ParseException;
5 6
 import java.text.SimpleDateFormat;
6 7
 import java.util.*;
7
-import java.util.stream.Collectors;
8 8
 import javax.servlet.http.HttpServletResponse;
9 9
 
10 10
 import com.alibaba.fastjson2.JSON;
11 11
 import com.alibaba.fastjson2.JSONArray;
12 12
 import com.alibaba.fastjson2.JSONObject;
13 13
 import com.ruoyi.common.utils.DateUtils;
14
+import com.ruoyi.common.utils.StringUtils;
14 15
 import com.ruoyi.oa.domain.*;
15 16
 import com.ruoyi.oa.service.*;
16
-import org.apache.poi.hpsf.Decimal;
17 17
 import org.springframework.beans.factory.annotation.Autowired;
18 18
 import org.springframework.web.bind.annotation.GetMapping;
19 19
 import org.springframework.web.bind.annotation.PostMapping;
@@ -44,19 +44,7 @@ public class CmcContractController extends BaseController
44 44
     private ICmcContractService cmcContractService;
45 45
 
46 46
     @Autowired
47
-    private ICmcSubContractService cmcSubContractService;
48
-
49
-    @Autowired
50
-    private ICmcProjectContractService cmcProjectContractService;
51
-
52
-    @Autowired
53
-    private ICmcContractSubContractService cmcContractSubContractService;
54
-
55
-    @Autowired
56
-    private ICmcBorrowService cmcBorrowService;
57
-
58
-    @Autowired
59
-    private ICmcSettleService cmcSettleService;
47
+    private ICmcContractPaidService cmcContractPaidService;
60 48
 
61 49
     /**
62 50
      * 查询cmc合同评审列表
@@ -276,6 +264,38 @@ public class CmcContractController extends BaseController
276 264
         util.exportExcel(response, list, "cmc合同评审数据");
277 265
     }
278 266
 
267
+    /**
268
+     * 导出选择字段cmc合同评审列表
269
+     */
270
+    @Log(title = "cmc合同评审", businessType = BusinessType.EXPORT)
271
+    @PostMapping("/exportSelectFields")
272
+    public void export(HttpServletResponse response, CmcContract cmcContract, String selectFields)
273
+    {
274
+        List<CmcContract> list = cmcContractService.selectCmcContractList(cmcContract);
275
+        for (CmcContract contract : list) {
276
+            CmcContractPaid cmcContractPaid = new CmcContractPaid();
277
+            cmcContractPaid.setContractId(contract.getContractId());
278
+            List<CmcContractPaid> cmcContractPaidList = cmcContractPaidService.selectCmcContractPaidList(cmcContractPaid);
279
+            BigDecimal paidAmount = new BigDecimal("0.00");
280
+            String paidPercentage = "";
281
+            for (CmcContractPaid contractPaid : cmcContractPaidList) {
282
+                paidAmount = paidAmount.add(contractPaid.getPaidAmount());
283
+            }
284
+            contract.setPaidAmount(paidAmount);
285
+            if (contract.getAmount().equals(new BigDecimal("0.00")) || paidAmount.equals(new BigDecimal("0.00"))) {
286
+                paidPercentage = "0%";
287
+            }
288
+            else {
289
+                paidPercentage = paidAmount.divide(contract.getAmount().multiply(new BigDecimal(100))).setScale(2, RoundingMode.HALF_UP) + "%";
290
+            }
291
+            contract.setPaidAmount(paidAmount);
292
+            contract.setPaidPercentage(paidPercentage);
293
+        }
294
+        List<String> selectFieldList = Arrays.asList(selectFields.split(","));
295
+        ExcelUtil<CmcContract> util = new ExcelUtil<CmcContract>(CmcContract.class);
296
+        util.exportExcel(response, selectFieldList, list, "cmc合同评审数据", StringUtils.EMPTY);
297
+    }
298
+
279 299
     /**
280 300
      * 获取cmc合同评审详细信息
281 301
      */

+ 97
- 0
oa-back/ruoyi-admin/src/main/java/com/ruoyi/web/controller/oa/CmcContractInvoiceController.java Zobrazit soubor

@@ -0,0 +1,97 @@
1
+package com.ruoyi.web.controller.oa;
2
+
3
+import java.util.List;
4
+import javax.servlet.http.HttpServletResponse;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.web.bind.annotation.GetMapping;
7
+import org.springframework.web.bind.annotation.PostMapping;
8
+import org.springframework.web.bind.annotation.PutMapping;
9
+import org.springframework.web.bind.annotation.DeleteMapping;
10
+import org.springframework.web.bind.annotation.PathVariable;
11
+import org.springframework.web.bind.annotation.RequestBody;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import com.ruoyi.common.annotation.Log;
15
+import com.ruoyi.common.core.controller.BaseController;
16
+import com.ruoyi.common.core.domain.AjaxResult;
17
+import com.ruoyi.common.enums.BusinessType;
18
+import com.ruoyi.oa.domain.CmcContractInvoice;
19
+import com.ruoyi.oa.service.ICmcContractInvoiceService;
20
+import com.ruoyi.common.utils.poi.ExcelUtil;
21
+import com.ruoyi.common.core.page.TableDataInfo;
22
+
23
+/**
24
+ * 合同开票Controller
25
+ * 
26
+ * @author cmc
27
+ * @date 2025-07-23
28
+ */
29
+@RestController
30
+@RequestMapping("/oa/contractInvoice")
31
+public class CmcContractInvoiceController extends BaseController
32
+{
33
+    @Autowired
34
+    private ICmcContractInvoiceService cmcContractInvoiceService;
35
+
36
+    /**
37
+     * 查询合同开票列表
38
+     */
39
+    @GetMapping("/list")
40
+    public TableDataInfo list(CmcContractInvoice cmcContractInvoice)
41
+    {
42
+        startPage();
43
+        List<CmcContractInvoice> list = cmcContractInvoiceService.selectCmcContractInvoiceList(cmcContractInvoice);
44
+        return getDataTable(list);
45
+    }
46
+
47
+    /**
48
+     * 导出合同开票列表
49
+     */
50
+    @Log(title = "合同开票", businessType = BusinessType.EXPORT)
51
+    @PostMapping("/export")
52
+    public void export(HttpServletResponse response, CmcContractInvoice cmcContractInvoice)
53
+    {
54
+        List<CmcContractInvoice> list = cmcContractInvoiceService.selectCmcContractInvoiceList(cmcContractInvoice);
55
+        ExcelUtil<CmcContractInvoice> util = new ExcelUtil<CmcContractInvoice>(CmcContractInvoice.class);
56
+        util.exportExcel(response, list, "合同开票数据");
57
+    }
58
+
59
+    /**
60
+     * 获取合同开票详细信息
61
+     */
62
+    @GetMapping(value = "/{invoiceId}")
63
+    public AjaxResult getInfo(@PathVariable("invoiceId") Integer invoiceId)
64
+    {
65
+        return success(cmcContractInvoiceService.selectCmcContractInvoiceByInvoiceId(invoiceId));
66
+    }
67
+
68
+    /**
69
+     * 新增合同开票
70
+     */
71
+    @Log(title = "合同开票", businessType = BusinessType.INSERT)
72
+    @PostMapping
73
+    public AjaxResult add(@RequestBody CmcContractInvoice cmcContractInvoice)
74
+    {
75
+        return toAjax(cmcContractInvoiceService.insertCmcContractInvoice(cmcContractInvoice));
76
+    }
77
+
78
+    /**
79
+     * 修改合同开票
80
+     */
81
+    @Log(title = "合同开票", businessType = BusinessType.UPDATE)
82
+    @PutMapping
83
+    public AjaxResult edit(@RequestBody CmcContractInvoice cmcContractInvoice)
84
+    {
85
+        return toAjax(cmcContractInvoiceService.updateCmcContractInvoice(cmcContractInvoice));
86
+    }
87
+
88
+    /**
89
+     * 删除合同开票
90
+     */
91
+    @Log(title = "合同开票", businessType = BusinessType.DELETE)
92
+	@DeleteMapping("/{contractIds}")
93
+    public AjaxResult remove(@PathVariable String[] contractIds)
94
+    {
95
+        return success(cmcContractInvoiceService.deleteCmcContractInvoiceByContractIds(contractIds));
96
+    }
97
+}

+ 70
- 0
oa-back/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java Zobrazit soubor

@@ -554,6 +554,24 @@ public class ExcelUtil<T>
554 554
         exportExcel(response);
555 555
     }
556 556
 
557
+    /**
558
+     * 对list数据源将其里面的数据导入到excel表单
559
+     *
560
+     * @param response 返回数据
561
+     * @param list 导出数据集合
562
+     * @param sheetName 工作表的名称
563
+     * @param title 标题
564
+     * @return 结果
565
+     */
566
+    public void exportExcel(HttpServletResponse response, List<String> selectFieldList, List<T> list, String sheetName, String title)
567
+    {
568
+        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
569
+        response.setCharacterEncoding("utf-8");
570
+        this.init(list, sheetName, title, Type.EXPORT);
571
+        this.fields = getFields(selectFieldList);
572
+        exportExcel(response);
573
+    }
574
+
557 575
     /**
558 576
      * 对list数据源将其里面的数据导入到excel表单
559 577
      * 
@@ -1476,6 +1494,58 @@ public class ExcelUtil<T>
1476 1494
         return fields;
1477 1495
     }
1478 1496
 
1497
+    /**
1498
+     * 获取字段注解信息
1499
+     */
1500
+    public List<Object[]> getFields(List<String> selectFieldList)
1501
+    {
1502
+        List<Object[]> fields = new ArrayList<Object[]>();
1503
+        List<Field> tempFields = new ArrayList<>();
1504
+        tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields()));
1505
+        tempFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
1506
+        for (Field field : tempFields)
1507
+        {
1508
+            String fieldName = field.getName().split("\\.")[field.getName().split("\\.").length - 1];
1509
+            if (selectFieldList.contains(fieldName) && !ArrayUtils.contains(this.excludeFields, field.getName()))
1510
+            {
1511
+                // 单注解
1512
+                if (field.isAnnotationPresent(Excel.class))
1513
+                {
1514
+                    Excel attr = field.getAnnotation(Excel.class);
1515
+                    if (attr != null && (attr.type() == Type.ALL || attr.type() == type))
1516
+                    {
1517
+                        field.setAccessible(true);
1518
+                        fields.add(new Object[] { field, attr });
1519
+                    }
1520
+                    if (Collection.class.isAssignableFrom(field.getType()))
1521
+                    {
1522
+                        subMethod = getSubMethod(field.getName(), clazz);
1523
+                        ParameterizedType pt = (ParameterizedType) field.getGenericType();
1524
+                        Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0];
1525
+                        this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class);
1526
+                    }
1527
+                }
1528
+
1529
+                // 多注解
1530
+                if (field.isAnnotationPresent(Excels.class))
1531
+                {
1532
+                    Excels attrs = field.getAnnotation(Excels.class);
1533
+                    Excel[] excels = attrs.value();
1534
+                    for (Excel attr : excels)
1535
+                    {
1536
+                        if (!ArrayUtils.contains(this.excludeFields, field.getName() + "." + attr.targetAttr())
1537
+                                && (attr != null && (attr.type() == Type.ALL || attr.type() == type)))
1538
+                        {
1539
+                            field.setAccessible(true);
1540
+                            fields.add(new Object[] { field, attr });
1541
+                        }
1542
+                    }
1543
+                }
1544
+            }
1545
+        }
1546
+        return fields;
1547
+    }
1548
+
1479 1549
     /**
1480 1550
      * 根据注解获取最大行高
1481 1551
      */

+ 13
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcContract.java Zobrazit soubor

@@ -60,6 +60,10 @@ public class CmcContract extends BaseEntity
60 60
     @Excel(name = "实际回款金额")
61 61
     private BigDecimal paidAmount;
62 62
 
63
+    /** 实际回款比例 */
64
+    @Excel(name = "实际回款比例")
65
+    private String paidPercentage;
66
+
63 67
     /** 履约保证金 */
64 68
     @Excel(name = "履约保证金")
65 69
     private BigDecimal deposit;
@@ -281,6 +285,15 @@ public class CmcContract extends BaseEntity
281 285
     {
282 286
         return paidAmount;
283 287
     }
288
+    public void setPaidPercentage(String paidPercentage)
289
+    {
290
+        this.paidPercentage = paidPercentage;
291
+    }
292
+
293
+    public String getPaidPercentage()
294
+    {
295
+        return paidPercentage;
296
+    }
284 297
     public void setDeposit(BigDecimal deposit)
285 298
     {
286 299
         this.deposit = deposit;

+ 98
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/domain/CmcContractInvoice.java Zobrazit soubor

@@ -0,0 +1,98 @@
1
+package com.ruoyi.oa.domain;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+import com.fasterxml.jackson.annotation.JsonFormat;
6
+import org.apache.commons.lang3.builder.ToStringBuilder;
7
+import org.apache.commons.lang3.builder.ToStringStyle;
8
+import com.ruoyi.common.annotation.Excel;
9
+import com.ruoyi.common.core.domain.BaseEntity;
10
+
11
+/**
12
+ * 合同开票对象 cmc_contract_invoice
13
+ * 
14
+ * @author cmc
15
+ * @date 2025-07-23
16
+ */
17
+public class CmcContractInvoice extends BaseEntity
18
+{
19
+    private static final long serialVersionUID = 1L;
20
+
21
+    /** 开票id */
22
+    private Integer invoiceId;
23
+
24
+    /** 合同id */
25
+    @Excel(name = "合同id")
26
+    private String contractId;
27
+
28
+    /** 开票比例 */
29
+    @Excel(name = "开票比例")
30
+    private String invoicePercentage;
31
+
32
+    /** 开票金额 */
33
+    @Excel(name = "开票金额")
34
+    private BigDecimal invoiceAmount;
35
+
36
+    /** 开票时间 */
37
+    @JsonFormat(pattern = "yyyy-MM-dd")
38
+    @Excel(name = "开票时间", width = 30, dateFormat = "yyyy-MM-dd")
39
+    private Date invoiceTime;
40
+
41
+    public void setInvoiceId(Integer invoiceId) 
42
+    {
43
+        this.invoiceId = invoiceId;
44
+    }
45
+
46
+    public Integer getInvoiceId() 
47
+    {
48
+        return invoiceId;
49
+    }
50
+    public void setContractId(String contractId) 
51
+    {
52
+        this.contractId = contractId;
53
+    }
54
+
55
+    public String getContractId() 
56
+    {
57
+        return contractId;
58
+    }
59
+    public void setInvoicePercentage(String invoicePercentage) 
60
+    {
61
+        this.invoicePercentage = invoicePercentage;
62
+    }
63
+
64
+    public String getInvoicePercentage() 
65
+    {
66
+        return invoicePercentage;
67
+    }
68
+    public void setInvoiceAmount(BigDecimal invoiceAmount) 
69
+    {
70
+        this.invoiceAmount = invoiceAmount;
71
+    }
72
+
73
+    public BigDecimal getInvoiceAmount() 
74
+    {
75
+        return invoiceAmount;
76
+    }
77
+    public void setInvoiceTime(Date invoiceTime) 
78
+    {
79
+        this.invoiceTime = invoiceTime;
80
+    }
81
+
82
+    public Date getInvoiceTime() 
83
+    {
84
+        return invoiceTime;
85
+    }
86
+
87
+    @Override
88
+    public String toString() {
89
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
90
+            .append("invoiceId", getInvoiceId())
91
+            .append("contractId", getContractId())
92
+            .append("invoicePercentage", getInvoicePercentage())
93
+            .append("invoiceAmount", getInvoiceAmount())
94
+            .append("invoiceTime", getInvoiceTime())
95
+            .append("remark", getRemark())
96
+            .toString();
97
+    }
98
+}

+ 62
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/mapper/CmcContractInvoiceMapper.java Zobrazit soubor

@@ -0,0 +1,62 @@
1
+package com.ruoyi.oa.mapper;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcContractInvoice;
5
+
6
+/**
7
+ * 合同开票Mapper接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2025-07-23
11
+ */
12
+public interface CmcContractInvoiceMapper 
13
+{
14
+    /**
15
+     * 查询合同开票
16
+     * 
17
+     * @param invoiceId 合同开票主键
18
+     * @return 合同开票
19
+     */
20
+    public CmcContractInvoice selectCmcContractInvoiceByInvoiceId(Integer invoiceId);
21
+
22
+    /**
23
+     * 查询合同开票列表
24
+     * 
25
+     * @param cmcContractInvoice 合同开票
26
+     * @return 合同开票集合
27
+     */
28
+    public List<CmcContractInvoice> selectCmcContractInvoiceList(CmcContractInvoice cmcContractInvoice);
29
+
30
+    /**
31
+     * 新增合同开票
32
+     * 
33
+     * @param cmcContractInvoice 合同开票
34
+     * @return 结果
35
+     */
36
+    public int insertCmcContractInvoice(CmcContractInvoice cmcContractInvoice);
37
+
38
+    /**
39
+     * 修改合同开票
40
+     * 
41
+     * @param cmcContractInvoice 合同开票
42
+     * @return 结果
43
+     */
44
+    public int updateCmcContractInvoice(CmcContractInvoice cmcContractInvoice);
45
+
46
+    /**
47
+     * 删除合同开票
48
+     * 
49
+     * @param contractId 合同开票主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcContractInvoiceByContractId(String contractId);
53
+
54
+    /**
55
+     * 批量删除合同开票
56
+     *
57
+     * @param contractIds 需要删除的合同开票主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcContractInvoiceByContractIds(String[] contractIds);
61
+
62
+}

+ 62
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/ICmcContractInvoiceService.java Zobrazit soubor

@@ -0,0 +1,62 @@
1
+package com.ruoyi.oa.service;
2
+
3
+import java.util.List;
4
+import com.ruoyi.oa.domain.CmcContractInvoice;
5
+
6
+/**
7
+ * 合同开票Service接口
8
+ * 
9
+ * @author cmc
10
+ * @date 2025-07-23
11
+ */
12
+public interface ICmcContractInvoiceService 
13
+{
14
+    /**
15
+     * 查询合同开票
16
+     * 
17
+     * @param invoiceId 合同开票主键
18
+     * @return 合同开票
19
+     */
20
+    public CmcContractInvoice selectCmcContractInvoiceByInvoiceId(Integer invoiceId);
21
+
22
+    /**
23
+     * 查询合同开票列表
24
+     * 
25
+     * @param cmcContractInvoice 合同开票
26
+     * @return 合同开票集合
27
+     */
28
+    public List<CmcContractInvoice> selectCmcContractInvoiceList(CmcContractInvoice cmcContractInvoice);
29
+
30
+    /**
31
+     * 新增合同开票
32
+     * 
33
+     * @param cmcContractInvoice 合同开票
34
+     * @return 结果
35
+     */
36
+    public int insertCmcContractInvoice(CmcContractInvoice cmcContractInvoice);
37
+
38
+    /**
39
+     * 修改合同开票
40
+     * 
41
+     * @param cmcContractInvoice 合同开票
42
+     * @return 结果
43
+     */
44
+    public int updateCmcContractInvoice(CmcContractInvoice cmcContractInvoice);
45
+
46
+    /**
47
+     * 删除合同开票
48
+     *
49
+     * @param ContractId 合同开票主键
50
+     * @return 结果
51
+     */
52
+    public int deleteCmcContractInvoiceByContractId(String ContractId);
53
+
54
+    /**
55
+     * 批量删除合同开票
56
+     *
57
+     * @param contractIds 需要删除的合同开票主键集合
58
+     * @return 结果
59
+     */
60
+    public int deleteCmcContractInvoiceByContractIds(String[] contractIds);
61
+
62
+}

+ 93
- 0
oa-back/ruoyi-system/src/main/java/com/ruoyi/oa/service/impl/CmcContractInvoiceServiceImpl.java Zobrazit soubor

@@ -0,0 +1,93 @@
1
+package com.ruoyi.oa.service.impl;
2
+
3
+import java.util.List;
4
+import org.springframework.beans.factory.annotation.Autowired;
5
+import org.springframework.stereotype.Service;
6
+import com.ruoyi.oa.mapper.CmcContractInvoiceMapper;
7
+import com.ruoyi.oa.domain.CmcContractInvoice;
8
+import com.ruoyi.oa.service.ICmcContractInvoiceService;
9
+
10
+/**
11
+ * 合同开票Service业务层处理
12
+ * 
13
+ * @author cmc
14
+ * @date 2025-07-23
15
+ */
16
+@Service
17
+public class CmcContractInvoiceServiceImpl implements ICmcContractInvoiceService 
18
+{
19
+    @Autowired
20
+    private CmcContractInvoiceMapper cmcContractInvoiceMapper;
21
+
22
+    /**
23
+     * 查询合同开票
24
+     * 
25
+     * @param invoiceId 合同开票主键
26
+     * @return 合同开票
27
+     */
28
+    @Override
29
+    public CmcContractInvoice selectCmcContractInvoiceByInvoiceId(Integer invoiceId)
30
+    {
31
+        return cmcContractInvoiceMapper.selectCmcContractInvoiceByInvoiceId(invoiceId);
32
+    }
33
+
34
+    /**
35
+     * 查询合同开票列表
36
+     * 
37
+     * @param cmcContractInvoice 合同开票
38
+     * @return 合同开票
39
+     */
40
+    @Override
41
+    public List<CmcContractInvoice> selectCmcContractInvoiceList(CmcContractInvoice cmcContractInvoice)
42
+    {
43
+        return cmcContractInvoiceMapper.selectCmcContractInvoiceList(cmcContractInvoice);
44
+    }
45
+
46
+    /**
47
+     * 新增合同开票
48
+     * 
49
+     * @param cmcContractInvoice 合同开票
50
+     * @return 结果
51
+     */
52
+    @Override
53
+    public int insertCmcContractInvoice(CmcContractInvoice cmcContractInvoice)
54
+    {
55
+        return cmcContractInvoiceMapper.insertCmcContractInvoice(cmcContractInvoice);
56
+    }
57
+
58
+    /**
59
+     * 修改合同开票
60
+     * 
61
+     * @param cmcContractInvoice 合同开票
62
+     * @return 结果
63
+     */
64
+    @Override
65
+    public int updateCmcContractInvoice(CmcContractInvoice cmcContractInvoice)
66
+    {
67
+        return cmcContractInvoiceMapper.updateCmcContractInvoice(cmcContractInvoice);
68
+    }
69
+
70
+    /**
71
+     * 删除合同开票信息
72
+     *
73
+     * @param contractId 合同开票主键
74
+     * @return 结果
75
+     */
76
+    @Override
77
+    public int deleteCmcContractInvoiceByContractId(String contractId)
78
+    {
79
+        return cmcContractInvoiceMapper.deleteCmcContractInvoiceByContractId(contractId);
80
+    }
81
+
82
+    /**
83
+     * 批量删除合同开票
84
+     *
85
+     * @param contractIds 需要删除的合同开票主键集合
86
+     * @return 结果
87
+     */
88
+    @Override
89
+    public int deleteCmcContractInvoiceByContractIds(String[] contractIds)
90
+    {
91
+        return cmcContractInvoiceMapper.deleteCmcContractInvoiceByContractIds(contractIds);
92
+    }
93
+}

+ 75
- 0
oa-back/ruoyi-system/src/main/resources/mapper/oa/CmcContractInvoiceMapper.xml Zobrazit soubor

@@ -0,0 +1,75 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.ruoyi.oa.mapper.CmcContractInvoiceMapper">
6
+    
7
+    <resultMap type="CmcContractInvoice" id="CmcContractInvoiceResult">
8
+        <result property="invoiceId"    column="invoice_id"    />
9
+        <result property="contractId"    column="contract_id"    />
10
+        <result property="invoicePercentage"    column="invoice_percentage"    />
11
+        <result property="invoiceAmount"    column="invoice_amount"    />
12
+        <result property="invoiceTime"    column="invoice_time"    />
13
+        <result property="remark"    column="remark"    />
14
+    </resultMap>
15
+
16
+    <sql id="selectCmcContractInvoiceVo">
17
+        select invoice_id, contract_id, invoice_percentage, invoice_amount, invoice_time, remark from cmc_contract_invoice
18
+    </sql>
19
+
20
+    <select id="selectCmcContractInvoiceList" parameterType="CmcContractInvoice" resultMap="CmcContractInvoiceResult">
21
+        <include refid="selectCmcContractInvoiceVo"/>
22
+        <where>  
23
+            <if test="contractId != null  and contractId != ''"> and contract_id = #{contractId}</if>
24
+            <if test="invoicePercentage != null  and invoicePercentage != ''"> and invoice_percentage = #{invoicePercentage}</if>
25
+            <if test="invoiceAmount != null "> and invoice_amount = #{invoiceAmount}</if>
26
+            <if test="invoiceTime != null "> and invoice_time = #{invoiceTime}</if>
27
+        </where>
28
+    </select>
29
+    
30
+    <select id="selectCmcContractInvoiceByInvoiceId" parameterType="Integer" resultMap="CmcContractInvoiceResult">
31
+        <include refid="selectCmcContractInvoiceVo"/>
32
+        where invoice_id = #{invoiceId}
33
+    </select>
34
+        
35
+    <insert id="insertCmcContractInvoice" parameterType="CmcContractInvoice" useGeneratedKeys="true" keyProperty="invoiceId">
36
+        insert into cmc_contract_invoice
37
+        <trim prefix="(" suffix=")" suffixOverrides=",">
38
+            <if test="contractId != null">contract_id,</if>
39
+            <if test="invoicePercentage != null">invoice_percentage,</if>
40
+            <if test="invoiceAmount != null">invoice_amount,</if>
41
+            <if test="invoiceTime != null">invoice_time,</if>
42
+            <if test="remark != null">remark,</if>
43
+         </trim>
44
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
45
+            <if test="contractId != null">#{contractId},</if>
46
+            <if test="invoicePercentage != null">#{invoicePercentage},</if>
47
+            <if test="invoiceAmount != null">#{invoiceAmount},</if>
48
+            <if test="invoiceTime != null">#{invoiceTime},</if>
49
+            <if test="remark != null">#{remark},</if>
50
+         </trim>
51
+    </insert>
52
+
53
+    <update id="updateCmcContractInvoice" parameterType="CmcContractInvoice">
54
+        update cmc_contract_invoice
55
+        <trim prefix="SET" suffixOverrides=",">
56
+            <if test="contractId != null">contract_id = #{contractId},</if>
57
+            <if test="invoicePercentage != null">invoice_percentage = #{invoicePercentage},</if>
58
+            <if test="invoiceAmount != null">invoice_amount = #{invoiceAmount},</if>
59
+            <if test="invoiceTime != null">invoice_time = #{invoiceTime},</if>
60
+            <if test="remark != null">remark = #{remark},</if>
61
+        </trim>
62
+        where invoice_id = #{invoiceId}
63
+    </update>
64
+
65
+    <delete id="deleteCmcContractInvoiceByContractId" parameterType="String">
66
+        delete from cmc_contract_invoice where contract_id = #{contractId}
67
+    </delete>
68
+
69
+    <delete id="deleteCmcContractInvoiceByContractIds" parameterType="String">
70
+        delete from cmc_contract_invoice where contract_id in
71
+        <foreach item="contractId" collection="array" open="(" separator="," close=")">
72
+            #{contractId}
73
+        </foreach>
74
+    </delete>
75
+</mapper>

Loading…
Zrušit
Uložit