fuliqi
2024-03-21 4c3685ea4fb7365382df29d18b6c8349d476695a
Merge remote-tracking branch 'origin/master'
6个文件已添加
489 ■■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/AccountingRules.java
New file
@@ -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();
    }
}
ycl-server/src/main/java/com/ycl/platform/controller/AccountingRulesController.java
New file
@@ -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));
    }
}
ycl-server/src/main/java/com/ycl/platform/mapper/AccountingRulesMapper.java
New file
@@ -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);
}
ycl-server/src/main/java/com/ycl/platform/service/IAccountingRulesService.java
New file
@@ -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);
}
ycl-server/src/main/java/com/ycl/platform/service/impl/AccountingRulesServiceImpl.java
New file
@@ -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);
    }
}
ycl-server/src/main/resources/mapper/system/AccountingRulesMapper.xml
New file
@@ -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>