每日总结

今天写了一点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 @   一个小虎牙  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
点击右上角即可分享
微信分享提示