# 智慧社区管理系统-核心业务功能-04保修信息

news2024/7/6 18:35:38

一 后端

1:entity

package com.woniu.community.entity;

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

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Repair {
    private int id;
    private String comId;
    private String comDate;
    private int ownerId;
    private Integer status;
    private int clr;
    private String remarks;
    private  String userName;
    private String  name;


}

2:Repairmapper

package com.woniu.community.mapper;

import com.woniu.community.entity.Owner;
import com.woniu.community.entity.Repair;

import java.util.List;

public interface RepairMapper {
    List<Repair> selectAll(String name, Integer status, int start, int size);
    int  count(String name, Integer status);
    int insertRepair(Repair repair);
    int  deleteRepair(int id);
    int  updateRepair(Repair repair);
    Repair selectById(int  id);
}

3:IRepairService

package com.woniu.community.service;

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


public interface IRepairService {
   HttpResult selectAll(String name, Integer status, int pageIndex, int pageSize);
    HttpResult insertRepair(Repair repair);
    HttpResult  deleteRepair(int id);
    HttpResult  updateRepair(Repair repair);
    HttpResult selectById(int  id);
}

4:RepairServiceImpl

package com.woniu.community.service.impl;

import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.Repair;
import com.woniu.community.mapper.RepairMapper;
import com.woniu.community.service.IRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.swing.*;
import java.util.List;

@Service
public class RepairServiceImpl implements IRepairService {
    @Autowired(required = false)
    private RepairMapper repairMapper;

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

        }
        return result;
    }

    @Override
    public HttpResult insertRepair(Repair repair) {
        HttpResult result=null;
        int count = repairMapper.insertRepair(repair);
        if (count>0){
            result=new HttpResult(null,0,200,"添加成功");
        }else{
            result=new HttpResult(null,0,500,"添加失败");

        }
        return result;
    }

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

        }
        return result;
    }

    @Override
    public HttpResult updateRepair(Repair repair) {
        HttpResult result=null;
        int count = repairMapper.updateRepair(repair);
        if (count>0){
            result=new HttpResult(null,0,200,"修改成功");
        }else{
            result=new HttpResult(null,0,500,"修改失败");

        }
        return result;
    }

    @Override
    public HttpResult selectById(int id) {
        HttpResult result=null;
        Repair repair = repairMapper.selectById(id);
        if (repair!=null){
            result=new HttpResult(repair,0,200,null);
        }else{
            result=new HttpResult(null,0,500,"没有更多数据");

        }
        return result;
    }
}

5:RepairController

package com.woniu.community.controller;

import com.woniu.community.entity.HttpResult;
import com.woniu.community.entity.Repair;
import com.woniu.community.service.IRepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/repair")
@CrossOrigin(origins = "*")
public class RepairController {
    @Autowired
    private IRepairService iRepairService;
    @RequestMapping("list")
    HttpResult selectAll(String name, Integer status, int pageIndex, int pageSize){
        return iRepairService.selectAll(name,status,pageIndex,pageSize);
    }
    @RequestMapping("add")
    HttpResult insertRepair(Repair repair){
        return iRepairService.insertRepair(repair);
    }
    @RequestMapping("delete")
    HttpResult  deleteRepair(int id){
        return iRepairService.deleteRepair(id);
    }
    @RequestMapping("update")
    HttpResult  updateRepair(Repair repair){
        return iRepairService.updateRepair(repair);
    }
    @RequestMapping("info")
    HttpResult selectById(int  id){
        return iRepairService.selectById(id);
    }
}

6:RepairMapper.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.RepairMapper">
    <resultMap id="repairMap" type="Repair">
        <result column="id" property="id"/>
        <result column="com_id" property="comId"/>
        <result column="com_date" property="comDate"/>
        <result column="owner_id" property="ownerId"/>
        <result column="status" property="status"/>
        <result column="clr" property="clr"/>
        <result column="remarks" property="remarks"/>
        <result column="username" property="userName"/>
        <result column="name" property="name"/>

    </resultMap>
    <select id="selectAll" resultMap="repairMap">
        select
               re.name,r.*,o.username
        from
             repair r left  join
                              owner  o on
                               r.owner_id=o.id
                                left  join

                                 repairtype re on
                                  r.com_id=re.id
        <where>
            <if test="name!=null and name!='' and name!='null'">
                and re.name like '%${name}%'
            </if>
        <if test="status!=null">
            and   status=#{status}
        </if>
        </where>
        limit #{start},#{size}

    </select>

    <select id="count" resultType="int">
        select
        count(r.id)
        from
        repair r left  join
        owner  o on
        r.owner_id=o.id
        left  join

        repairtype re on
        r.com_id=re.id
        <where>
            <if test="name!=null and name!='' and name!='null'">
                and re.name like '%${name}%'
            </if>
            <if test="status!=null">
                and   status=#{status}
            </if>
        </where>
    </select>

    <insert id="insertRepair">
        insert into  repair(com_id,remarks,owner_id,com_date,status,clr)
                values (#{comId},#{remarks},#{ownerId},#{comDate},#{status},#{clr})

    </insert>

    <delete id="deleteRepair">
            delete from repair where id=#{id}
    </delete>

    <update id="updateRepair">
        update repair set status=#{status} where  id=#{id}
    </update>
    <select id="selectById" resultMap="repairMap">
        select * from  repair 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: 50px;">
            <div class="row">
                <div class="col-md-3" style="height: 20px;margin-bottom: 15px;">
                    维修类型:<select style="width: 150px;" v-model="name">
                    <option >公共部位维修</option>
                    <option >共用设施设备 </option>
                    <option >自用部位维修</option>
                    <option >门窗维修</option>
                    <option >电路维修</option>
                    <option >电梯</option>

                </select>
                </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 repairs">
                    <td>{{c.name}}</td>
                    <td>{{c.remarks}}</td>
                    <td>{{c.userName}}</td>
                    <td>{{c.comDate}}</td>
                    <td>{{c.status==1?"已处理":"未处理"}}</td>
                    <td>{{c.clr}}</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: {
            repairs:null,
            pageIndex:1,
            pageSize:6,
            pageTotal:0,
            pageNum:0,
            name:'',
            status:'',
        },
        methods: {
            requestRepairList(url){
                axios.get(url).then(response=>{
                    this.repairs=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/repair/list?pageIndex="+p+"&pageSize="+this.pageSize+"&name="+this.name+"&status="+this.status;
                console.log(url);
                this.requestRepairList(url);
            },
            doAdd(){
                window.parent.main_right.location.href = "repair_add_update.html";

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

            },
            doDelete(id){
                var  url="http://localhost:8080/repair/delete?id="+id;
                axios.get(url).then(response=>{
                    if (response.data.code==200){
                        var  url="http://localhost:8080/repair/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;
                        this.requestRepairList(url);
                    }else{
                        alert(response.data.msg)
                    }
                })
            },
        },
        created: function () {
            var  url="http://localhost:8080/repair/list?pageIndex="+this.pageIndex+"&pageSize="+this.pageSize;
            this.requestRepairList(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 style="width: 150px;" v-model="comId">
                    <option value="1">公共部位维修</option>
                    <option value="2">共用设施设备 </option>
                    <option value="4">自用部位维修</option>
                    <option value="5">门窗维修</option>
                    <option value="7">电路维修</option>
                    <option value="3">电梯</option>
                </select><br>
                    <label>保修内容</label>
                    <input type="text" v-model="remarks"><br>
                    保修人:<select v-model="ownerId">
                    <option v-for="o in ownerList":value="o.id">{{o.userName}}</option>
                </select><br>
                    <label>保修时间:</label>
                    <input type="date"  v-model="comDate"/><br>
                    处理状态:<select v-model="status">
                    <option value="1">已处理</option>
                    <option value="0">未处理</option>
                </select><br>
                    <label>处理人</label>
                    <input type="text" v-model="clr">
                </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,
            comId:null,
            remarks:null,
            ownerId:null,
            ownerList:null,
            comDate:null,
            status:'',
            clr:null,
            repairId:null,
        },
        methods: {
            requestOwnerList(){
                var url="http://localhost:8080/owner/list?pageIndex=1&pageSize=100";
                axios.get(url).then(response=>{
                    this.ownerList=response.data.data;
                })
            },
            doSave(){
                if (this.repairId==null){
                    this.title="添加";
                    console.log(url)
                    var  url="http://localhost:8080/repair/add?comId="+this.comId+"&remarks="+this.remarks+"&ownerId="+this.ownerId+"&comDate="+this.comDate+"&status="+this.status+"&clr="+this.clr;
                    axios.get(url).then(response=>{
                        if (response.data.code==200){
                            window.parent.main_right.location.href = "repair_list.html";

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

                    })

                }else{
                    this.title="报修处理";
                    var  url="http://localhost:8080/repair/update?status="+this.status+"&id="+this.repairId;
                    axios.get(url).then(response=>{
                        if (response.data.code==200){
                            window.parent.main_right.location.href = "repair_list.html";

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

                    })
                }
            },
            doNot(){
                history.go(-1);
            },
        },
        created: function () {
        this. requestOwnerList();
            var url=window.location.href;
            if (url.indexOf("id")!=-1){
                this.repairId=url.substring(url.indexOf("=")+1)
                console.log(this.repairId)
            }
            if (this.repairId==null){
                this.title="添加";
            }else{
                this.title="报修处理";
                var url="http://localhost:8080/repair/info?id="+this.repairId;
                axios.get(url).then(response=>{
                    this.comId=response.data.data.comId;
                    this.remarks=response.data.data.remarks;
                    this.ownerId=response.data.data.ownerId;
                    this.comDate=response.data.data.comDate;
                    this.status=response.data.data.status;
                    this.clr=response.data.data.clr;
                })

            }

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

三 页面效果

在这里插入图片描述

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

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

相关文章

[附源码]计算机毕业设计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…

LeetCode 441. 排列硬币

&#x1f308;&#x1f308;&#x1f604;&#x1f604; 欢迎来到茶色岛独家岛屿&#xff0c;本期将为大家揭晓LeetCode 441. 排列硬币 &#xff0c;做好准备了么&#xff0c;那么开始吧。 &#x1f332;&#x1f332;&#x1f434;&#x1f434; 一、题目名称 LeetCode 441. …

Java基于springboot+vue的游戏物品销售购物商城系统 前后端分离

随着时代和计算机的发展&#xff0c;出现了越来越多的网络游戏&#xff0c;相对应的也拥有了越来越多的玩家&#xff0c;这些玩家在玩了一段游戏之后&#xff0c;可能会有游戏交易的需求。如果直接在私下个人交易很不安全&#xff0c;容易被骗。为了能够让广大游戏爱好者拥有一…

.net6 web api中使用SqlSugar(MySQL数据库)

其中SqlSugar&#xff0c;也可以是EFcore&#xff0c;或者Dapper&#xff0c;或者其他ORM框架。 其中mysql&#xff0c;也可以是SqlServer&#xff0c;或者oracle&#xff0c;或者其他数据库类型。 1.首先使用vs2022建立.net6 web api 2.增加SqlSugar和MySQL依赖项。 Newton…

17.前端笔记-CSS-定位

1、为什么要定位 先看看以下这些场景是否可以用标准流或浮动实现 &#xff08;1&#xff09;某个元素可以自由的在一个盒子内移动位置&#xff0c;并且压住其他盒子 &#xff08;2&#xff09;滚动窗口时&#xff0c;某些盒子是可以固定在屏幕某个位置的 以上这种场景使用标准…

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

一 后端 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;//开始时间pr…

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…