From 945afec19a11ea45375ab1a0e739ef8fc4d22ed1 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期四, 21 三月 2024 16:31:13 +0800
Subject: [PATCH] 核算规则

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java |   91 ++++++++++
 ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml                  |   81 +++++++++
 ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java         |   62 ++++++
 ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java            |   62 ++++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java             |  102 +++++++++++
 ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java    |   91 ++++++++++
 6 files changed, 489 insertions(+), 0 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java
new file mode 100644
index 0000000..bed10cf
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java
@@ -0,0 +1,102 @@
+package com.ycl.platform.domain.entity;
+
+
+import annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.ycl.system.entity.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+
+/**
+ * 鏍哥畻瑙勫垯瀵硅薄 t_accounting_rules
+ *
+ * @author gonghl
+ * @date 2024-03-21
+ */
+public class AccountingRules extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private Integer id;
+
+    /**
+     * 瑙勫垯鍚嶇О
+     */
+    @Excel(name = "瑙勫垯鍚嶇О")
+    private String rulesName;
+
+    /**
+     * 鍚堝悓鍚嶇О
+     */
+    @Excel(name = "鍚堝悓鍚嶇О")
+    private String contractName;
+
+    /**
+     * 閲戦
+     */
+    @Excel(name = "閲戦")
+    private BigDecimal amount;
+
+    /**
+     * 閫昏緫鍒犻櫎
+     */
+    @TableLogic
+    private String deleted;
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setRulesName(String rulesName) {
+        this.rulesName = rulesName;
+    }
+
+    public String getRulesName() {
+        return rulesName;
+    }
+
+    public void setContractName(String contractName) {
+        this.contractName = contractName;
+    }
+
+    public String getContractName() {
+        return contractName;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setDeleted(String deleted) {
+        this.deleted = deleted;
+    }
+
+    public String getDeleted() {
+        return deleted;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("rulesName", getRulesName())
+                .append("contractName", getContractName())
+                .append("amount", getAmount())
+                .append("createTime", getCreateTime())
+                .append("updateTime", getUpdateTime())
+                .append("deleted", getDeleted())
+                .toString();
+    }
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java b/ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java
new file mode 100644
index 0000000..dba521e
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java
@@ -0,0 +1,91 @@
+package com.ycl.platform.controller;
+
+import annotation.Log;
+import com.ycl.platform.domain.entity.AccountingRules;
+import com.ycl.platform.service.IAccountingRulesService;
+import com.ycl.system.AjaxResult;
+import com.ycl.system.controller.BaseController;
+import com.ycl.system.page.TableDataInfo;
+import com.ycl.utils.poi.ExcelUtil;
+import enumeration.BusinessType;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 鏍哥畻瑙勫垯Controller
+ *
+ * @author gonghl
+ * @date 2024-03-21
+ */
+@RestController
+@RequestMapping("/platform/rules")
+public class AccountingRulesController extends BaseController {
+    @Autowired
+    private IAccountingRulesService accountingRulesService;
+
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯鍒楄〃
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(AccountingRules accountingRules) {
+        startPage();
+        List<AccountingRules> list = accountingRulesService.selectAccountingRulesList(accountingRules);
+        return getDataTable(list);
+    }
+
+    /**
+     * 瀵煎嚭鏍哥畻瑙勫垯鍒楄〃
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:export')")
+    @Log(title = "鏍哥畻瑙勫垯", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, AccountingRules accountingRules) {
+        List<AccountingRules> list = accountingRulesService.selectAccountingRulesList(accountingRules);
+        ExcelUtil<AccountingRules> util = new ExcelUtil<AccountingRules>(AccountingRules.class);
+        util.exportExcel(response, list, "鏍哥畻瑙勫垯鏁版嵁");
+    }
+
+    /**
+     * 鑾峰彇鏍哥畻瑙勫垯璇︾粏淇℃伅
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id) {
+        return success(accountingRulesService.selectAccountingRulesById(id));
+    }
+
+    /**
+     * 鏂板鏍哥畻瑙勫垯
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:add')")
+    @Log(title = "鏍哥畻瑙勫垯", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody AccountingRules accountingRules) {
+        return toAjax(accountingRulesService.insertAccountingRules(accountingRules));
+    }
+
+    /**
+     * 淇敼鏍哥畻瑙勫垯
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:edit')")
+    @Log(title = "鏍哥畻瑙勫垯", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody AccountingRules accountingRules) {
+        return toAjax(accountingRulesService.updateAccountingRules(accountingRules));
+    }
+
+    /**
+     * 鍒犻櫎鏍哥畻瑙勫垯
+     */
+    @PreAuthorize("@ss.hasPermi('platform:rules:remove')")
+    @Log(title = "鏍哥畻瑙勫垯", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids) {
+        return toAjax(accountingRulesService.deleteAccountingRulesByIds(ids));
+    }
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java
new file mode 100644
index 0000000..54a81cd
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java
@@ -0,0 +1,62 @@
+package com.ycl.platform.mapper;
+
+
+import com.ycl.platform.domain.entity.AccountingRules;
+
+import java.util.List;
+
+/**
+ * 鏍哥畻瑙勫垯Mapper鎺ュ彛
+ *
+ * @author gonghl
+ * @date 2024-03-21
+ */
+public interface AccountingRulesMapper {
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 鏍哥畻瑙勫垯
+     */
+    public AccountingRules selectAccountingRulesById(Integer id);
+
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯鍒楄〃
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 鏍哥畻瑙勫垯闆嗗悎
+     */
+    public List<AccountingRules> selectAccountingRulesList(AccountingRules accountingRules);
+
+    /**
+     * 鏂板鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    public int insertAccountingRules(AccountingRules accountingRules);
+
+    /**
+     * 淇敼鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    public int updateAccountingRules(AccountingRules accountingRules);
+
+    /**
+     * 鍒犻櫎鏍哥畻瑙勫垯
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteAccountingRulesById(Integer id);
+
+    /**
+     * 鎵归噺鍒犻櫎鏍哥畻瑙勫垯
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteAccountingRulesByIds(Integer[] ids);
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java b/ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java
new file mode 100644
index 0000000..c65edf7
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java
@@ -0,0 +1,62 @@
+package com.ycl.platform.service;
+
+
+import com.ycl.platform.domain.entity.AccountingRules;
+
+import java.util.List;
+
+/**
+ * 鏍哥畻瑙勫垯Service鎺ュ彛
+ *
+ * @author gonghl
+ * @date 2024-03-21
+ */
+public interface IAccountingRulesService {
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 鏍哥畻瑙勫垯
+     */
+    public AccountingRules selectAccountingRulesById(Integer id);
+
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯鍒楄〃
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 鏍哥畻瑙勫垯闆嗗悎
+     */
+    public List<AccountingRules> selectAccountingRulesList(AccountingRules accountingRules);
+
+    /**
+     * 鏂板鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    public int insertAccountingRules(AccountingRules accountingRules);
+
+    /**
+     * 淇敼鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    public int updateAccountingRules(AccountingRules accountingRules);
+
+    /**
+     * 鎵归噺鍒犻櫎鏍哥畻瑙勫垯
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏍哥畻瑙勫垯涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteAccountingRulesByIds(Integer[] ids);
+
+    /**
+     * 鍒犻櫎鏍哥畻瑙勫垯淇℃伅
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 缁撴灉
+     */
+    public int deleteAccountingRulesById(Integer id);
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java
new file mode 100644
index 0000000..626a045
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java
@@ -0,0 +1,91 @@
+package com.ycl.platform.service.impl;
+
+import com.ycl.platform.domain.entity.AccountingRules;
+import com.ycl.platform.mapper.AccountingRulesMapper;
+import com.ycl.platform.service.IAccountingRulesService;
+import com.ycl.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 鏍哥畻瑙勫垯Service涓氬姟灞傚鐞�
+ *
+ * @author gonghl
+ * @date 2024-03-21
+ */
+@Service
+public class AccountingRulesServiceImpl implements IAccountingRulesService {
+    @Autowired
+    private AccountingRulesMapper accountingRulesMapper;
+
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 鏍哥畻瑙勫垯
+     */
+    @Override
+    public AccountingRules selectAccountingRulesById(Integer id) {
+        return accountingRulesMapper.selectAccountingRulesById(id);
+    }
+
+    /**
+     * 鏌ヨ鏍哥畻瑙勫垯鍒楄〃
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 鏍哥畻瑙勫垯
+     */
+    @Override
+    public List<AccountingRules> selectAccountingRulesList(AccountingRules accountingRules) {
+        return accountingRulesMapper.selectAccountingRulesList(accountingRules);
+    }
+
+    /**
+     * 鏂板鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertAccountingRules(AccountingRules accountingRules) {
+        accountingRules.setCreateTime(DateUtils.getNowDate());
+        accountingRules.setDeleted("0");
+        return accountingRulesMapper.insertAccountingRules(accountingRules);
+    }
+
+    /**
+     * 淇敼鏍哥畻瑙勫垯
+     *
+     * @param accountingRules 鏍哥畻瑙勫垯
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateAccountingRules(AccountingRules accountingRules) {
+        accountingRules.setUpdateTime(DateUtils.getNowDate());
+        return accountingRulesMapper.updateAccountingRules(accountingRules);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎鏍哥畻瑙勫垯
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏍哥畻瑙勫垯涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteAccountingRulesByIds(Integer[] ids) {
+        return accountingRulesMapper.deleteAccountingRulesByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎鏍哥畻瑙勫垯淇℃伅
+     *
+     * @param id 鏍哥畻瑙勫垯涓婚敭
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteAccountingRulesById(Integer id) {
+        return accountingRulesMapper.deleteAccountingRulesById(id);
+    }
+}
diff --git a/ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml b/ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml
new file mode 100644
index 0000000..8c1923b
--- /dev/null
+++ b/ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml
@@ -0,0 +1,81 @@
+<?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.ycl.platform.mapper.AccountingRulesMapper">
+
+    <resultMap type="com.ycl.platform.domain.entity.AccountingRules" id="AccountingRulesResult">
+        <result property="id" column="id"/>
+        <result property="rulesName" column="rules_name"/>
+        <result property="contractName" column="contract_name"/>
+        <result property="amount" column="amount"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="deleted" column="deleted"/>
+    </resultMap>
+
+    <sql id="selectAccountingRulesVo">
+        select id, rules_name, contract_name, amount, create_time, update_time, deleted
+        from t_accounting_rules
+    </sql>
+
+    <select id="selectAccountingRulesList" parameterType="com.ycl.platform.domain.entity.AccountingRules" resultMap="AccountingRulesResult">
+        <include refid="selectAccountingRulesVo"/>
+        <where>
+            <if test="rulesName != null  and rulesName != ''">and rules_name like concat('%', #{rulesName}, '%')</if>
+            <if test="contractName != null  and contractName != ''">and contract_name like concat('%', #{contractName}, '%')</if>
+            <if test="deleted != null  and deleted != ''">and deleted = #{deleted}</if>
+        </where>
+    </select>
+
+    <select id="selectAccountingRulesById" parameterType="Integer" resultMap="AccountingRulesResult">
+        <include refid="selectAccountingRulesVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertAccountingRules" parameterType="com.ycl.platform.domain.entity.AccountingRules" useGeneratedKeys="true" keyProperty="id">
+        insert into t_accounting_rules
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="rulesName != null">rules_name,</if>
+            <if test="contractName != null">contract_name,</if>
+            <if test="amount != null">amount,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="deleted != null">deleted,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="rulesName != null">#{rulesName},</if>
+            <if test="contractName != null">#{contractName},</if>
+            <if test="amount != null">#{amount},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="deleted != null">#{deleted},</if>
+        </trim>
+    </insert>
+
+    <update id="updateAccountingRules" parameterType="com.ycl.platform.domain.entity.AccountingRules">
+        update t_accounting_rules
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="rulesName != null">rules_name = #{rulesName},</if>
+            <if test="contractName != null">contract_name = #{contractName},</if>
+            <if test="amount != null">amount = #{amount},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="deleted != null">deleted = #{deleted},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteAccountingRulesById" parameterType="Integer">
+        delete
+        from t_accounting_rules
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteAccountingRulesByIds" parameterType="String">
+        delete from t_accounting_rules where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0