每日总结

今天写了一点erp的页面和后端。

public class PayController {
    @Autowired
    private PayService payService;

    @GetMapping
    public Result page(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer pageSize,
                         String customername, String paymentstatus, String productName, String status,
                         @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end,
                       @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin1, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end1) {
        PageBean pageBean = payService.page(page, pageSize,customername,paymentstatus,productName, status ,begin, end,begin1,end1);
        return Result.success(pageBean);
    }

    @PostMapping
    public Result add(@RequestBody Payment payment){
        payService.add(payment);
        return Result.success();
    }
    @DeleteMapping("/{id}")
    public Result deletes(@PathVariable int [] id){
        payService.delete(id);
        return Result.success();
    }
<?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.example.mapper.PayMapper">
    <delete id="delete">
        delete from payorder where id in
        <foreach collection="id" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </delete>
    <select id="count" resultType="java.lang.Long">
        select count(*) from payorder
        <where>
            <if test="customername!=null ">
                and customername like concat('%', #{customername}, '%')
            </if>
            <if test="paymentstatus!=null and paymentstatus!='' ">
                and paymentstatus = #{paymentstatus}
            </if>
            <if test="productName!=null ">
                and product_name like concat('%', #{productName}, '%')
            </if>
            <if test="status!=null and status!='' ">
                and status = #{status}
            </if>
            <if test="begin!=null and end!=null">
                and orderdate between #{begin} and #{end}
            </if>
            <if test="begin1!=null and end1!=null">
                and finishdate between #{begin1} and #{end1}
            </if>
        </where>
    </select>
    <select id="page" resultType="com.example.pojo.Payment">
        select * from payorder
        <where>
            <if test="customername!=null ">
                and customername like concat('%', #{customername}, '%')
            </if>
            <if test="paymentstatus!=null and paymentstatus!='' ">
                and paymentstatus = #{paymentstatus}
            </if>
            <if test="productName!=null ">
                and product_name like concat('%', #{productName}, '%')
            </if>
            <if test="status!=null and status!='' ">
                and status = #{status}
            </if>
            <if test="begin!=null and end!=null">
                and orderdate between #{begin} and #{end}
            </if>
            <if test="begin1!=null and end1!=null">
                and finishdate between #{begin1} and #{end1}
            </if>
        </where>
        limit #{start},#{pageSize}
    </select>
</mapper>

 

posted @ 2023-11-19 19:37  一个小虎牙  阅读(20)  评论(0)    收藏  举报