上善若水
学习目标
1、一周掌握 JAVA入门到进阶知识(持续写作中……)
2、掌握基础C#l窗体知识(创作中……)
3、手把手教你vbs脚本制作(完善中……)
4、强大的 IDEA编程利器(编写中……)
5、经典常见的 面试题目技巧(更新中……)
前言
支付宝扫五福活动开始了,,,,
送上几张福的图片给大家……
你们都扫到了什么福
小峯希望:2021新的一年,想要的都拥有,得不到的都释怀!
下面开始进入正题……
数据库(Mysql)
CREATE TABLE `filterelement` (
`filterelement_id` varchar(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NOT NULL COMMENT '滤芯编号',
`filterelement_name` varchar(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NOT NULL COMMENT '滤芯名称',
`validity` varchar(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NOT NULL COMMENT '可用天数',
`replacementdays` varchar(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NULL DEFAULT NULL COMMENT '最低更换天数',
`Images` varchar(255) CHARACTER SET utf8 COLLATE
utf8_general_ci NOT NULL COMMENT '濾芯图片',
`create_by` varchar(32) CHARACTER SET utf8 COLLATE
utf8_general_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` timestamp(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_by` varchar(32) CHARACTER SET utf8 COLLATE
utf8_general_ci NULL DEFAULT NULL COMMENT '更新人',
`update_time` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
PRIMARY KEY (`filterelement_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci
COMMENT = '滤芯表\r\n' ROW_FORMAT = Compact;
SET FOREIGN_KEY_CHECKS = 1;
依赖导包
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-parent</artifactId>
<version>2.4.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jeecg-boot-module-system</artifactId>
<repositories>
<repository>
<id>aliyun</id>
<name>aliyun Repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jeecg</id>
<name>jeecg Repository</name>
<url>http://maven.jeecg.org/nexus/content/repositories/jeecg</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-system-local-api</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-starter-redis</artifactId>
</dependency>
<dependency>
<groupId>org.jeecgframework.boot</groupId>
<artifactId>jeecg-boot-module-demo</artifactId>
<version>${
jeecgboot.version}</version>
</dependency>
<!-- 积木报表 -->
<dependency>
<groupId>com.jimureport</groupId>
<artifactId>spring-boot-starter-jimureport</artifactId>
<version>1.1.08-beta</version>
<exclusions>
<exclusion>
<artifactId>autopoi-web</artifactId>
<groupId>org.jeecgframework</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<!--微服务模式下修改为true,跳过此打包插件,否则微服务模块无法引用-->
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
后台代码
小惊喜(图标 banner.txt)
idea的 src\main\resources 下面新建一个banner.txt
// O //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 祖师爷保佑 永不宕机 永无BUG //
pojo 实体类
package org.jeecg.modules.equipment.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.Date;
@Data
@TableName("filterelement")
public class Filterelement {
@TableId(type = IdType.ASSIGN_UUID)
private String filterelementId;
private String filterelementName;
private String validity;
private String replacementdays;
private String images;
private String createBy;
private Date createTime;
private String updateBy;
private Date updateTime;
}
2. mapper 层
package org.jeecg.modules.equipment.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.jeecg.modules.equipment.entity.Filterelement;
/**
* @author: 王文峯
* @date: 2021-01-30 10:35
* @description: TODO
* @modifiedBy:
* @version: 1.0
*/
@Mapper
public interface IFilterelementMapper extends BaseMapper<Filterelement> {
}
3. service 层
package org.jeecg.modules.equipment.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.equipment.entity.Filterelement;
/**
* @author: 王文峯
* @date: 2021-01-30 10:39
* @description: TODO
* @modifiedBy:
* @version: 1.0
*/
public interface IFilterelementService extends IService<Filterelement> {
}
4. service 类 实现类
package org.jeecg.modules.equipment.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.equipment.entity.Filterelement;
import org.jeecg.modules.equipment.mapper.IFilterelementMapper;
import org.jeecg.modules.equipment.service.IFilterelementService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* @author: 王文峯
* @date: 2021-01-30 10:39
* @description: TODO
* @modifiedBy:
* @version: 1.0
*/
@Service("IFilterelementService")
@Transactional
public class FilterelementServiceImpl extends ServiceImpl<IFilterelementMapper, Filterelement> implements IFilterelementService {
}
## 5. 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="org.jeecg.modules.equipment.mapper.IFilterelementMapper">
</mapper>
6. controller 层
package org.jeecg.modules.equipment.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.equipment.entity.Filterelement;
import org.jeecg.modules.equipment.service.IFilterelementService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.sql.ResultSet;
/**
* @author: 王文峯
* @date: 2021-01-30 10:41
* @description: TODO
* @modifiedBy:
* @version: 1.0
*/
@RestController
@RequestMapping("/equipment/filterelement")
public class IFilterelementController {
@Resource
private IFilterelementService iFilterelementService;
// 请求方式要注意规范
@RequestMapping(value = "/list" ,method = RequestMethod.GET)
public Result<IPage<Filterelement>> list(Filterelement filterelement,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req){
Result<IPage<Filterelement>> result = new Result<IPage<Filterelement>>();
//封装分页条件
Page<Filterelement> page = new Page<Filterelement>(pageNo, pageSize);
//封装查询条件
QueryWrapper<Filterelement> queryWrapper = QueryGenerator.initQueryWrapper(filterelement,req.getParameterMap());
//mybatis plus 自带的分页条件查询的方法
Page<Filterelement> ipage = iFilterelementService.page(page, queryWrapper);
result.setResult(ipage);
return result;
}
}
前端代码
<template>
<a-card :bordered="false">
<!-- 左侧面板 -->
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="12">
<a-col :md="7" :sm="8">
<a-form-item label="滤芯名称" :labelCol="{span: 6}" :wrapperCol="{span: 14, offset: 1}">
<a-input placeholder="请输入滤芯名称" v-model="queryParam.filterelementName"></a-input>
</a-form-item>
</a-col>
<a-col :md="7" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
<div class="table-operator" style="border-top: 5px">
<a-button @click="handleAdd" type="primary" icon="plus">添加</a-button>
</div>
<a-table
ref="table"
rowKey="id"
size="middle"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">
<a-icon type="edit"/>
编辑
</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="() =>handleDelete(record.filterelementId)">
<a>删除</a>
</a-popconfirm>
</span>
</a-table>
</div>
<filterelement-modal ref="modalForm" @ok="modalFormOk"></filterelement-modal>
</a-card>
</template>
<script>
import {
JeecgListMixin } from '@/mixins/JeecgListMixin'
import FilterelementModal from './modules/FilterelementModal'
export default {
name: "FilterelementList",
mixins:[JeecgListMixin],
//属性
components:{
FilterelementModal},
data() {
return {
// 查询条件
queryParam: {
filterelementName:"",
},
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:60,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '滤芯名称',
align:"center",
dataIndex: 'filterelementName'
},
{
title: '滤芯展示图',
align:"center",
dataIndex: 'images',
},
{
title: '有效时长',
align:"center",
dataIndex: 'validity'
},
{
title: '滤芯最低更换天数',
align: "center",
dataIndex: 'replacementdays',
},
{
title: '操作',
dataIndex: 'action',
align:"center",
//替换普通文本为自定义组件
scopedSlots: {
customRender: 'action' },
}
],
url: {
list: "/equipment/filterelement/list",//查询接口
delete:"/equipment/filterelement/del"
},
}
},
//方法
methods: {
}
}
</script>
测试
正常显示,成功!
转载:https://blog.csdn.net/Feng_wwf/article/details/113525589
查看评论