# 智慧社区管理系统-核心业务管理-01车位收费

news2024/12/23 7:37:20

一 后端

1:entity

package com.woniu.community.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CarCharge {
    private int id;
    private String payDate;//开始时间
    private  String endDate;//结束时间
    private Double money;
    private Integer  status;//缴费状态:0表示未交,1表示已交
    private int ownerId;
    private String remarks;//备注
    private String type;//收费类型
    private String parkId;//车位外键
    private String numbers;
    private String userName;


}

2:CarChargeMapper

package com.woniu.community.mapper;

import com.woniu.community.entity.CarCharge;

import java.util.List;

public interface CarChargeMapper {
    List<CarCharge> selectAll(String numbers,Integer  status,int start,int size);
    int count(String numbers,Integer  status);
    int  insertCarCharge(CarCharge carCharge);
    int  deleteCarCharge(int id);
    int  updateMoney(CarCharge carCharge);
    CarCharge getById(int id);
}

3:ICarChargeService

package com.woniu.community.service;

import com.woniu.community.entity.CarCharge;
import com.woniu.community.entity.HttpResult;



public interface ICarChargeService {
   HttpResult selectAll(String numbers, Integer  status, int pageIndex, int pageSize);

    HttpResult  insertCarCharge(CarCharge carCharge);
    HttpResult  deleteCarCharge(int id);
    HttpResult  updateMoney(CarCharge carCharge);
    HttpResult getById(int id);
}

4:CarChargeServiceImpl

package com.woniu.community.service.impl;

import com.woniu.community.entity.CarCharge;
import com.woniu.community.entity.HttpResult;
import com.woniu.community.mapper.CarChargeMapper;
import com.woniu.community.service.ICarChargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CarChargeServiceImpl implements ICarChargeService {
    @Autowired(required =false)
    private CarChargeMapper carChargeMapper;

    @Override
    public HttpResult selectAll(String numbers, Integer status, int pageIndex, int pageSize) {
        HttpResult  result=null;
        List<CarCharge> carCharges = carChargeMapper.selectAll(numbers, status, (pageIndex - 1) * pageSize, pageSize);
        int count = carChargeMapper.count(numbers, status);
        if (carCharges!=null&&carCharges.size()>0){
            result=new HttpResult(carCharges,count,200,null);
        }else{
            result=new HttpResult(null,0,500,"没有更多数据");

        }
        return result;
    }


    @Override
    public HttpResult insertCarCharge(CarCharge carCharge) {
        HttpResult  result=null;
        int count = carChargeMapper.insertCarCharge(carCharge);
        if (count>0){
            result=new HttpResult(null,0,200,"添加成功");
        }else{
            result=new HttpResult(null,0,500,"添加失败");

        }
        return result;
    }

    @Override
    public HttpResult deleteCarCharge(int id) {
        HttpResult  result=null;
        int count = carChargeMapper.deleteCarCharge(id);
        if (count>0){
            result=new HttpResult(null,0,200,"删除成功");
        }else{
            result=new HttpResult(null,0,500,"删除失败");

        }
        return result;
    }

    @Override
    public HttpResult updateMoney(CarCharge carCharge) {
        HttpResult  result=null;
        int count = carChargeMapper.updateMoney(carCharge);
        if (count>0){
            result=new HttpResult(null,0,200,"修改成功");
        }else{
            result=new HttpResult(null,0,500,"修改失败");

        }
        return result;
    }

    @Override
    public HttpResult getById(int id) {
        HttpResult  result=null;
        CarCharge carCharge = carChargeMapper.getById(id);
        if (carCharge!=null){
            result=new HttpResult(carCharge,0,200,null);
        }else{
            result=new HttpResult(null,0,500,"没有更多数据");

        }
        return result;
    }
}

5:CarChargeController

package com.woniu.community.controller;

import com.woniu.community.entity.CarCharge;
import com.woniu.community.entity.HttpResult;
import com.woniu.community.service.ICarChargeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/carCharge")
@CrossOrigin(origins = "*")
public class CarChargeController {
    @Autowired
    private ICarChargeService iCarChargeService;

    @RequestMapping("/list")
    HttpResult selectAll(String numbers, Integer  status, int pageIndex, int pageSize){
        return iCarChargeService.selectAll(numbers,status,pageIndex,pageSize);
    }
    @RequestMapping("/add")
    HttpResult insertCarCharge(  CarCharge carCharge){
        return  iCarChargeService.insertCarCharge(carCharge);
    }
    @RequestMapping("/delete")
    HttpResult  deleteCarCharge(int id){
        return iCarChargeService.deleteCarCharge(id);
    }
    @RequestMapping("/update")
    HttpResult  updateMoney( CarCharge carCharge){
        return iCarChargeService.updateMoney(carCharge);
    }
    @RequestMapping("/info")
    HttpResult getById(int id){
        return iCarChargeService.getById(id);

    }
}

6:CarChargeMapper.xml

<?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.woniu.community.mapper.CarChargeMapper">
    <resultMap id="carMap" type="CarCharge">
        <result column="id" property="id"/>
        <result column="pay_date" property="payDate"/>
        <result column="end_date" property="endDate"/>
        <result column="money" property="money"/>
        <result column="status" property="status"/>
        <result column="owner_id" property="ownerId"/>
        <result column="remarks" property="remarks"/>
        <result column="type" property="type"/>
        <result column="park_id" property="parkId"/>
        <result column="numbers" property="numbers"/>
        <result column="username" property="userName"/>
    </resultMap>
    <select id="selectAll" resultMap="carMap">
        select
               c.*,p.numbers,o.username
        from
             carcharge c left  join parking p  on
            c.park_id=p.id
            left  join owner o on
            c.owner_id=o.id
        <where>
            <if test="numbers!=null and numbers!='' and  numbers!='null' ">
                and  p.numbers=#{numbers}
            </if>
            <if test="status!=null">
                and  c.status=#{status}
            </if>
        </where>
        limit #{start},#{size}
    </select>

    <select id="count" resultType="int">
        select
       count(c.id)
        from
        carcharge c left  join parking p  on
        c.park_id=p.id
        left  join owner o on
        c.owner_id=o.id
        <where>
            <if test="numbers !=null  and numbers !='' and numbers!='null'">
                and  p.numbers=#{numbers}
            </if>
            <if test="status!=null  ">
                and  c.status=#{status}
            </if>
        </where>

    </select>

    <insert id="insertCarCharge">
        insert  into
            carcharge(park_id,owner_id,pay_date,end_date,money,status)
            values (#{parkId},#{ownerId},#{payDate},#{endDate},#{money},#{status})
    </insert>

    <delete id="deleteCarCharge">
        delete from carcharge
                        where  id=#{id}
    </delete>

    <update id="updateMoney">
        update carcharge set
            money=#{money},status=#{status}
                where  id=#{id}
    </update>

    <select id="getById" resultMap="carMap">
        select * from carcharge where  id=#{id};
    </select>
</mapper>

二 后端


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="assets/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/right.css" rel="stylesheet">
    <script src="assets/jquery-3.5.1.min.js"></script>
    <script src="assets/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <script src="assets/vue.min-v2.5.16.js"></script>
    <script src="assets/vue-router.min-2.7.0.js"></script>
    <script src="assets/axios.min.js"></script>
</head>
<body>
<div id="app" class="container">
    <div class="row">
        <div class="col-md-12" style="height: 80px; line-height: 20px;">
            <div class="row">
                <div class="col-md-3" style="height: 20px;margin-bottom: 15px">
                    车位号:<input type="text" v-model="numbers">
                </div>
                <div class="col-md-3" style="height: 20px;margin-bottom: 15px;">
                   缴费状态:<select style="width: 150px;" v-model="status">
                        <option value="1">已缴费</option>
                        <option value="0">未缴费</option>
                </select>
                </div>
                <div class="col-md-3" style="height: 20px;margin-bottom: 15px">
                    <button class="btn btn-primary" @click="doQuery">搜索</button>

                </div>
            </div>
            <button class="btn btn-info" @click="doAdd">新增</button>
        </div>
    </div>
    <div class="row">
        <div class="col-md-12">
            <table class="table table-striped">
                <caption>车位收费</caption>
                <thead>
                    <tr>
                        <th>车位号码</th>
                        <th>户主</th>
                        <th>开始时间</th>
                        <th>结束时间</th>
                        <th>金额</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr v-for="c  in carCharts">
                        <td>{{c.numbers}}</td>
                        <td>{{c.userName}}</td>
                        <td>{{c.payDate}}</td>
                        <td>{{c.endDate}}</td>
                        <td>{{c.money}}</td>
                        <td>{{c.status==1?"已缴费":"未缴费"}}</td>

                        <td v-if="c.status==1">
                            <button class="btn btn-danger" @click="doDelete(c.id)">删除</button>
                        </td>
                        <td v-else="c.status==0">
                            <button class="btn btn-info" @click="doUpdate(c.id)">缴费</button>
                            <button class="btn btn-danger" @click="doDelete(c.id)">删除</button>
                        </td>
                    </tr>
                </tbody>
            </table>
            <ul class="pagination" v-for="p in pageNum">
                <li v-if="p==pageIndex" class="active"><a @click="doGO(p)">{{p}}</a></li>
                <li v-else="p==pageIndex"><a @click="doGO(p)">{{p}}</a></li>
            </ul>
        </div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            carCharts:null,
            pageIndex:1,
            pageSize:4,
            pageTotal:0,
            pageNum:0,
            numbers:'',
            status:'',
        },
        methods: {
            requestCarList(url){
                axios.get(url).then(response=>{
                    this.carCharts=response.data.data;
                    this.pageTotal=response.data.pageTotal;//总条数
                    this.pageNum=Math.ceil(this.pageTotal / this.pageSize);
                })
            },
            doQuery(){
                this.doGO(1);
            },
            doGO(p){
                this.pageIndex=p;
                var  url="http://localhost:8080/carCharge/list?pageIndex="+p+"&pageSize="+this.pageSize+"&numbers="+this.numbers+"&status="+this.status;
                console.log(url);
                this.requestCarList(url);
            },
            doUpdate(id){

                window.parent.main_right.location.href = "carChart_add_update.html?id="+id;
            },
            doAdd(){
                window.parent.main_right.location.href = "carChart_add_update.html";

            },

            doDelete(id){
            var url="http://localhost:8080/carCharge/delete?id="+id;
            axios.get(url).then(response=>{
                if (response.data.code==200){
                    var  url="http://localhost:8080/carCharge/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;
                    this.requestCarList(url);
                }else{
                    alert(response.data.msg)
                }
            })

            },


        },
        created: function () {
        var  url="http://localhost:8080/carCharge/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;
        this.requestCarList(url);
        }
    });
</script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="assets/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/right.css" rel="stylesheet">
    <script src="assets/jquery-3.5.1.min.js"></script>
    <script src="assets/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <script src="assets/vue.min-v2.5.16.js"></script>
    <script src="assets/vue-router.min-2.7.0.js"></script>
    <script src="assets/axios.min.js"></script>
    <script src="assets/date_picker.js"></script>
</head>
<body>
<div id="app" class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="row">
                <div class="col-md-12" style="text-align: center; font-weight: bold; font-size: 18px; height: 80px; line-height: 80px;">
                    {{title}}
                </div>
            </div>
            <div class="row">
                <div class="col-md-6 col-md-offset-3" style="height: 240px;">
                   车位号码:<select v-model="parkId">
                            <option v-for="p in pickList":value="p.id">{{p.numbers}}</option>
                   </select><br>
                    户主:<select v-model="ownerId">
                    <option v-for="o in ownerList":value="o.id">{{o.userName}}</option>
                </select><br>
                    <label>开始时间:</label>
                    <input type="date" class="form-control" v-model="payDate"/>
                    <label>结束时间:</label>
                    <input type="date" class="form-control" v-model="endDate"/>
                    <lable>金额</lable>
                    <input type="text" v-model="money"><br>
                    状态:<select v-model="status">
                        <option value="1">缴费</option>
                        <option value="0">未缴费</option>
                </select>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6 col-md-offset-3" style="height: 80px;">
                    <button class="btn btn-primary" @click="doSave">保存</button>
                    <button class="btn btn-default" @click="doNot">取消</button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    new Vue({
        el: '#app',
        data: {
            title:null,
            pickList:null,
            parkId:null,
            carChartsId:null,
            ownerId:null,
            ownerList:null,
            payDate:null,
            endDate:null,
            money:null,
            status:null,
        },
        methods: {
        requestParkingList(){
            var url="http://localhost:8080/parking/list?pageIndex=1&pageSize=100";
            axios.get(url).then(response=>{
                this.pickList=response.data.data;
            })
        },
            requestOwnerList(){
                var url="http://localhost:8080/owner/list?pageIndex=1&pageSize=100";
                axios.get(url).then(response=>{
                    this.ownerList=response.data.data;
                })
            },
            getById(){
                var url="http://localhost:8080/carCharge/info?id="+this.carChartsId;
                console.log(url);
                axios.get(url).then(response=>{
                    this.parkId=response.data.data.parkId;
                    this.ownerId=response.data.data.ownerId;
                    this.payDate=response.data.data.payDate;
                    this.endDate=response.data.data.endDate;
                    this.money=response.data.data.money;
                    this.status=response.data.data.status;
                })
            },

            doSave(){
            if (this.carChartsId==null){
                this.title="添加车户"
                var  url="http://localhost:8080/carCharge/add?parkId="+this.parkId+"&ownerId="+this.ownerId+"&payDate="+this.payDate+"&endDate="+this.endDate+"&money="+this.money+"&status="+this.status;
                console.log(url)
                axios.get(url).then(response=>{
                    if (response.data.code==200){
                        window.parent.main_right.location.href = "carChart_list.html";

                    }else{
                        alert(response.data.msg)
                    }

                })
            }else{
                this.title="缴费"
                var   url="http://localhost:8080/carCharge/update?money="+this.money+"&status="+this.status+"&id="+this.carChartsId;
                console.log(url)
                axios.get(url).then(response=>{
                    if (response.data.code==200){
                        window.parent.main_right.location.href = "carChart_list.html";

                    }else{
                        alert(response.data.msg)
                    }

                })

            }

            },
            doNot(){
                history.go(-1);
            },

        },

        created: function () {
        this.requestParkingList();
        this.requestOwnerList();
            var  url=window.location.href;
            if (url.indexOf("id")!=-1){
                this.carChartsId=url.substring(url.indexOf("=")+1);
            }
            if (this.carChartsId==null){
                this.title="添加缴车户"
            }else{
                this.title="缴费"
                this.getById();

            }
        }
    });
</script>
</body>
</html>

三 页面

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/59255.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Vue 官方文档2.x教程学习笔记 1 基础 1.6 Class 与 Style 绑定 1.6.1 绑定HTML Class

Vue 官方文档2.x教程学习笔记 文章目录Vue 官方文档2.x教程学习笔记1 基础1.6 Class 与 Style 绑定1.6.1 绑定HTML Class1 基础 1.6 Class 与 Style 绑定 操作元素的 class 列表和内联样式是数据绑定的一个常见需求。 因为它们都是 attribute&#xff0c;所以我们可以用 v-b…

浅析Vue3动态组件怎么进行异常处理

Vue3动态组件怎么进行异常处理&#xff1f;下面本篇文章带大家聊聊Vue3 动态组件异常处理的方法&#xff0c;希望对大家有所帮助&#xff01; 动态组件有两种常用场景&#xff1a; 一是动态路由&#xff1a; // 动态路由 export const asyncRouterMap: Array<RouteRecordR…

【算法】山东大学人工智能限选课实验一(八数码问题)

实验一 八数码问题 1. 题目介绍 八数码问题描述为&#xff1a;在 33 组成的九宫格棋盘上&#xff0c;摆有 8 张牌&#xff0c;每张牌都刻有 1-8 中的某一个数码。棋盘中留有一个空格&#xff0c;允许其周围的某张牌向空格移动&#xff0c;这样通过移动牌就可以不断改变棋盘布…

【实验报告NO.000001】MIT 6.858 Computer System Security - Lab 1

0x00. 一切开始之前 MIT 6.858 是面向高年级本科生与研究生开设的一门关于计算机系统安全&#xff08;secure computer security&#xff09;的课程&#xff0c;内容包括威胁模型&#xff08;threat models&#xff09;、危害安全的攻击&#xff08;attacks that compromise s…

客快物流大数据项目(九十):ClickHouse的引擎介绍和深入日志引擎讲解

文章目录 ClickHouse的引擎介绍和深入日志引擎讲解 一、引擎介绍 二、日志引擎

【大数据趋势】12月3日纳指大概率反弹到黄金分割附近,然后下跌,之后进入趋势选择期,恒指会跟随。感觉或许有什么大事情要发生,瞎猜中。

行情核心源头分析: 纳斯达克指数 是否会符合大数据规则&#xff0c;走黄金分割线规则 回顾一下上周大数据预测的趋势&#xff0c;虽有波折但最终趋势预测准确 上周11.20日大数据模拟出一个趋势图&#xff0c;大趋势上需要继续上涨尾期&#xff0c;制造一个背离出现&#xff0c…

ZMQ中请求-应答模式的可靠性设计

一、什么是可靠性&#xff1f; 要给可靠性下定义&#xff0c;我们可以先界定它的相反面——故障。如果我们可以处理某些类型的故障&#xff0c;那么我们的模型对于这些故障就是可靠的。下面我们就来列举分布式ZMQ应用程序中可能发生的问题&#xff0c;从可能性高的故障开始&…

[附源码]计算机毕业设计springboot演唱会门票售卖系统

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

总结:原生servlet请求转发url与请求重定向url的使用区别

总结&#xff1a;原生servlet请求转发url与请求重定向url的使用区别一演示前提&#xff1a;1.演示案例的项目架构如图&#xff1a;2.设置web应用的映射根目录&#xff1a;/lmf&#xff0c;当然也可以不设置。二什么叫请求转发、请求重定向&#xff1f;1.请求转发解释图2. forwa…

Windows 文件共享功能使用方法, 局域网多台电脑之间传送文件

设想一下&#xff0c;家里或者公司有多台电脑&#xff0c;连接同一个Wifi&#xff0c;也就是处于同一个局域网中。 在不能使用微信、网盘的文件传输功能的情况下&#xff0c;这多台电脑之间&#xff0c;就只能用U盘传送数据吗&#xff1f; 不。Windows系统中已经提供了文件共享…

关于DDR协议一些操作的理解1

整体流程: 一些基本概念: 1.p_bank和l_bank 2.rank和bank 3.DIMM和SIMM 4.DLL概念: DDR控制器架构: 时钟频率对比: (1)

(1-线性回归问题)RBF神经网络

直接看公式&#xff0c;本质上就是非线性变换后的线性变化&#xff08;RBF神经网络的思想是将低维空间非线性不可分问题转换成高维空间线性可分问题&#xff09; Deeplearning Algorithms tutorial 谷歌的人工智能位于全球前列&#xff0c;在图像识别、语音识别、无人驾驶等技…

wy的leetcode刷题记录_Day56

wy的leetcode刷题记录_Day56 声明 本文章的所有题目信息都来源于leetcode 如有侵权请联系我删掉! 时间&#xff1a;2022-11-30 前言 目录wy的leetcode刷题记录_Day56声明前言895. 最大频率栈题目介绍思路代码收获236. 二叉树的最近公共祖先题目介绍思路代码收获895. 最大频率…

React项目中Manifest: Line: 1, column: 1, Syntax error的解决方法

大家好&#xff0c;今天和大家分享一个React项目中的一个小报错的解决方法。 在创建了一个项目后会有几个文件 public ---- 静态资源文件夹 favicon.ico ------ 网站页签图标 index.html -------- 主页面 logo192.png ------- logo图 logo512.png ------- logo图 manifest.js…

如何将C/C++代码转成webassembly

概述 WebAssembly/wasm WebAssembly 或者 wasm 是一个可移植、体积小、加载快并且兼容 Web 的全新格式 官网 &#xff1a; WebAssembly 快速上手&#xff1a; I want to… - WebAssemblyhttps://webassembly.org/getting-started/developers-guide/ 其实官网写的很详细&#xf…

局域网综合设计-----计算机网络

局域网综合设计 信息楼的配置 拓扑图 配置 全部在三层交换机配置 1.创建两个全局地址池vlan 52和valn53 全局地址池vlan52 全局地址池vlan53 2给vlan 52 和53 配置IP 地址 给vlan52配置ip并开启vlan52从全局地址池获取IP 子网 dns 给vlan53配置ip并开启vlan53从全局…

Android入门第37天-在子线程中调用Handler

简介 前一章我们以一个简单的小动画来解释了Handler。 这章我们会介绍在子线程里写Handler。如果是Handler写在了子线程中的话,我们就需要自己创建一个Looper对象了&#xff1a;创建的流程如下: 直接调用Looper.prepare()方法即可为当前线程创建Looper对象,而它的构造器会创…

Java并发编程—线程池

文章目录线程池什么是线程池线程池优点&#xff1a;线程复用技术线程池的实现原理是什么线程池执行任务的流程&#xff1f;线程池如何知道一个线程的任务已经执行完成线程池的核心参数拒绝策略线程池类型&#xff08;常用线程池&#xff09;阻塞队列执行execute()方法和submit(…

[附源码]计算机毕业设计springboot医疗纠纷处理系统

项目运行 环境配置&#xff1a; Jdk1.8 Tomcat7.0 Mysql HBuilderX&#xff08;Webstorm也行&#xff09; Eclispe&#xff08;IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持&#xff09;。 项目技术&#xff1a; SSM mybatis Maven Vue 等等组成&#xff0c;B/S模式 M…

MySQL统计函数count详解

MySQL统计函数count详解1. count()概述2. count(1)和count(*)和count(列名)的区别3. count(*)的实现方式1. count()概述 count() 是一个聚合函数&#xff0c;返回指定匹配条件的行数。开发中常用来统计表中数据&#xff0c;全部数据&#xff0c;不为null数据&#xff0c;或者去…