第一次提交,完成车牌车辆维护
parent
1d4bb42155
commit
ac79b89673
@ -0,0 +1,165 @@
|
|||||||
|
package com.ruoyi.web.controller.tyre;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.constant.TyreConstants;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.framework.util.ShiroUtils;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import javafx.scene.layout.BackgroundRepeat;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.tyre.domain.BaseCarbrand;
|
||||||
|
import com.ruoyi.tyre.service.IBaseCarbrandService;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品牌Controller
|
||||||
|
*
|
||||||
|
* @author dhl
|
||||||
|
* @date 2020-03-26
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/tyre/carbrand")
|
||||||
|
public class BaseCarbrandController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "tyre/carbrand";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBaseCarbrandService baseCarbrandService;
|
||||||
|
|
||||||
|
@RequiresPermissions("tyre:carbrand:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String carbrand()
|
||||||
|
{
|
||||||
|
return prefix + "/carbrand";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tyre:carbrand:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<BaseCarbrand> list = baseCarbrandService.selectBaseCarbrandList(baseCarbrand);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出品牌列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tyre:carbrand:export")
|
||||||
|
@Log(title = "品牌", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
List<BaseCarbrand> list = baseCarbrandService.selectBaseCarbrandList(baseCarbrand);
|
||||||
|
ExcelUtil<BaseCarbrand> util = new ExcelUtil<BaseCarbrand>(BaseCarbrand.class);
|
||||||
|
return util.exportExcel(list, "carbrand");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增品牌
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tyre:carbrand:add")
|
||||||
|
@Log(title = "品牌", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
if(StringUtils.isBlank(baseCarbrand.getBranno())){
|
||||||
|
//车牌号为空,给提示
|
||||||
|
return error("车牌号不能为空");
|
||||||
|
}
|
||||||
|
if (TyreConstants.BRANNO_NOT_UNIQUE.equals(baseCarbrandService.checkBrannoUnique(baseCarbrand)))
|
||||||
|
{
|
||||||
|
return error("新增车牌号码'" + baseCarbrand.getBranno() + "'失败,车牌号码已存在");
|
||||||
|
}
|
||||||
|
baseCarbrand.setRecorderid(ShiroUtils.getLoginName());//记录人信息
|
||||||
|
baseCarbrand.setRecordtime(new Date());
|
||||||
|
return toAjax(baseCarbrandService.insertBaseCarbrand(baseCarbrand));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改品牌
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{objid}")
|
||||||
|
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
|
||||||
|
{
|
||||||
|
BaseCarbrand baseCarbrand = baseCarbrandService.selectBaseCarbrandById(objid);
|
||||||
|
mmap.put("baseCarbrand", baseCarbrand);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tyre:carbrand:edit")
|
||||||
|
@Log(title = "品牌", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
if(StringUtils.isBlank(baseCarbrand.getBranno())){
|
||||||
|
//车牌号为空,给提示
|
||||||
|
return error("车牌号不能为空");
|
||||||
|
}
|
||||||
|
if (TyreConstants.BRANNO_NOT_UNIQUE.equals(baseCarbrandService.checkBrannoUnique(baseCarbrand)))
|
||||||
|
{
|
||||||
|
return error("修改车牌号码'" + baseCarbrand.getBranno() + "'失败,车牌号码已存在");
|
||||||
|
}
|
||||||
|
baseCarbrand.setRecorderid(ShiroUtils.getLoginName());//记录人信息
|
||||||
|
baseCarbrand.setRecordtime(new Date());
|
||||||
|
return toAjax(baseCarbrandService.updateBaseCarbrand(baseCarbrand));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除品牌
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("tyre:carbrand:remove")
|
||||||
|
@Log(title = "品牌", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(baseCarbrandService.deleteBaseCarbrandByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验车牌号码
|
||||||
|
*/
|
||||||
|
@PostMapping("/checkBrannoUnique")
|
||||||
|
@ResponseBody
|
||||||
|
public String checkBrannoUnique(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
return baseCarbrandService.checkBrannoUnique(baseCarbrand);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('新增车辆车牌')" />
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-carbrand-add">
|
||||||
|
<div class="form-group">
|
||||||
|
<!--<label class="col-sm-3 control-label">车牌号码:</label>-->
|
||||||
|
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>车牌号码:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="branno" id="branno" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<!--<label class="col-sm-3 control-label">车辆类型:</label>-->
|
||||||
|
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>车辆类型:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="cartype" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">备注:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "tyre/carbrand"
|
||||||
|
$("#form-carbrand-add").validate({
|
||||||
|
onkeyup: false,
|
||||||
|
rules:{
|
||||||
|
branno:{
|
||||||
|
remote: {
|
||||||
|
url: prefix + "/checkBrannoUnique",
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
"branno": function() {
|
||||||
|
return $.common.trim($("#branno").val());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataFilter: function(data, type) {
|
||||||
|
return $.validate.unique(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cartype:{
|
||||||
|
digits:true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
"branno": {
|
||||||
|
remote: "车牌号码已经存在"
|
||||||
|
},
|
||||||
|
"cartype":{
|
||||||
|
remote:"车辆类型不能为空"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/add", $('#form-carbrand-add').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,121 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('车牌列表')" />
|
||||||
|
</head>
|
||||||
|
<body class="gray-bg">
|
||||||
|
<div class="container-div">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-12 search-collapse">
|
||||||
|
<form id="formId">
|
||||||
|
<div class="select-list">
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
车牌号码:
|
||||||
|
<input type="text" name="branno"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
车辆类型:
|
||||||
|
<input type="text" name="cartype"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
记录人:
|
||||||
|
<input type="text" name="recorderid"/>
|
||||||
|
</li>
|
||||||
|
<li class="select-time">
|
||||||
|
<label>记录时间:</label>
|
||||||
|
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginRecordtime]"/>
|
||||||
|
<span>-</span>
|
||||||
|
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endRecordtime]"/>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||||
|
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-group-sm" id="toolbar" role="group">
|
||||||
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="tyre:carbrand:add">
|
||||||
|
<i class="fa fa-plus"></i> 添加
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="tyre:carbrand:edit">
|
||||||
|
<i class="fa fa-edit"></i> 修改
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tyre:carbrand:remove">
|
||||||
|
<i class="fa fa-remove"></i> 删除
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="tyre:carbrand:export">
|
||||||
|
<i class="fa fa-download"></i> 导出
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 select-table table-striped">
|
||||||
|
<table id="bootstrap-table"></table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
var editFlag = [[${@permission.hasPermi('tyre:carbrand:edit')}]];
|
||||||
|
var removeFlag = [[${@permission.hasPermi('tyre:carbrand:remove')}]];
|
||||||
|
var prefix = ctx + "tyre/carbrand";
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
var options = {
|
||||||
|
url: prefix + "/list",
|
||||||
|
createUrl: prefix + "/add",
|
||||||
|
updateUrl: prefix + "/edit/{id}",
|
||||||
|
removeUrl: prefix + "/remove",
|
||||||
|
exportUrl: prefix + "/export",
|
||||||
|
modalName: "车牌",
|
||||||
|
columns: [{
|
||||||
|
checkbox: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'objid',
|
||||||
|
title : '车牌ID',
|
||||||
|
visible: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'branno',
|
||||||
|
title : '车牌号码',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'cartype',
|
||||||
|
title : '车辆类型',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'recorderid',
|
||||||
|
title : '记录人',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'remark',
|
||||||
|
title : '备注',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field : 'recordtime',
|
||||||
|
title : '记录时间',
|
||||||
|
sortable: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
align: 'center',
|
||||||
|
formatter: function(value, row, index) {
|
||||||
|
var actions = [];
|
||||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objid + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||||
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objid + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||||
|
return actions.join('');
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
$.table.init(options);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||||
|
<head>
|
||||||
|
<th:block th:include="include :: header('修改车辆车牌')" />
|
||||||
|
<th:block th:include="include :: datetimepicker-css" />
|
||||||
|
</head>
|
||||||
|
<body class="white-bg">
|
||||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||||
|
<form class="form-horizontal m" id="form-carbrand-edit" th:object="${baseCarbrand}">
|
||||||
|
<input name="objid" th:field="*{objid}" type="hidden">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>车牌号码:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="branno" th:field="*{branno}" id="branno" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>车辆类型:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input name="cartype" th:field="*{cartype}" class="form-control" type="text" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">备注:</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<textarea name="remark" th:field="*{remark}" maxlength="500" class="form-control" rows="3"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<th:block th:include="include :: footer" />
|
||||||
|
<th:block th:include="include :: datetimepicker-js" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
var prefix = ctx + "tyre/carbrand";
|
||||||
|
$("#form-carbrand-edit").validate({
|
||||||
|
onkeyup: false,
|
||||||
|
rules:{
|
||||||
|
branno:{
|
||||||
|
remote: {
|
||||||
|
url: prefix + "/checkBrannoUnique",
|
||||||
|
type: "post",
|
||||||
|
dataType: "json",
|
||||||
|
data: {
|
||||||
|
"objid": function() {
|
||||||
|
return $("input[name='objid']").val();
|
||||||
|
},
|
||||||
|
"branno": function() {
|
||||||
|
return $.common.trim($("#branno").val());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dataFilter: function(data, type) {
|
||||||
|
return $.validate.unique(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
cartype:{
|
||||||
|
digits:true
|
||||||
|
},
|
||||||
|
},
|
||||||
|
messages: {
|
||||||
|
"branno": {
|
||||||
|
remote: "车牌号码已经存在"
|
||||||
|
},
|
||||||
|
"cartype":{
|
||||||
|
remote:"车辆类型不能为空"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
focusCleanup: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function submitHandler() {
|
||||||
|
if ($.validate.form()) {
|
||||||
|
$.operate.save(prefix + "/edit", $('#form-carbrand-edit').serialize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@ -0,0 +1,10 @@
|
|||||||
|
package com.ruoyi.common.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮胎车辆等信息常量
|
||||||
|
*/
|
||||||
|
public class TyreConstants {
|
||||||
|
/** 车牌号码是否唯一的返回结果码 */
|
||||||
|
public final static String BRANNO_UNIQUE = "0";
|
||||||
|
public final static String BRANNO_NOT_UNIQUE = "1";
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<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>
|
||||||
|
<artifactId>ruoyi</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>4.1.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-tyre</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-system</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,136 @@
|
|||||||
|
package com.ruoyi.tyre.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆车牌对象 base_carbrand
|
||||||
|
*
|
||||||
|
* @author dhl
|
||||||
|
* @date 2020-03-26
|
||||||
|
*/
|
||||||
|
public class BaseCarbrand extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 车牌ID */
|
||||||
|
private Long objid;
|
||||||
|
|
||||||
|
/** 车牌号码 */
|
||||||
|
@Excel(name = "车牌号码")
|
||||||
|
private String branno;
|
||||||
|
|
||||||
|
/** 车辆类型 */
|
||||||
|
@Excel(name = "车辆类型")
|
||||||
|
private String cartype;
|
||||||
|
|
||||||
|
/** 记录人 */
|
||||||
|
@Excel(name = "记录人")
|
||||||
|
private String recorderid;
|
||||||
|
|
||||||
|
/** 删除标志 */
|
||||||
|
@Excel(name = "删除标志")
|
||||||
|
private String deleteflag;
|
||||||
|
|
||||||
|
/** 记录时间 */
|
||||||
|
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date recordtime;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setObjid(Long objid)
|
||||||
|
{
|
||||||
|
this.objid = objid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getObjid()
|
||||||
|
{
|
||||||
|
return objid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBranno(String branno)
|
||||||
|
{
|
||||||
|
this.branno = branno;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotBlank(message = "车牌号不能为空")
|
||||||
|
@Size(min = 0, max = 30, message = "车牌号长度不能超过30个字符")
|
||||||
|
public String getBranno()
|
||||||
|
{
|
||||||
|
return branno;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCartype(String cartype)
|
||||||
|
{
|
||||||
|
this.cartype = cartype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCartype()
|
||||||
|
{
|
||||||
|
return cartype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRecorderid() {
|
||||||
|
return recorderid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecorderid(String recorderid) {
|
||||||
|
this.recorderid = recorderid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeleteflag(String deleteflag)
|
||||||
|
{
|
||||||
|
this.deleteflag = deleteflag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeleteflag()
|
||||||
|
{
|
||||||
|
return deleteflag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRecordtime(Date recordtime)
|
||||||
|
{
|
||||||
|
this.recordtime = recordtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getRecordtime()
|
||||||
|
{
|
||||||
|
return recordtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|
||||||
|
.append("objid", getObjid())
|
||||||
|
|
||||||
|
.append("branno", getBranno())
|
||||||
|
|
||||||
|
.append("cartype", getCartype())
|
||||||
|
|
||||||
|
.append("recorderid", getRecorderid())
|
||||||
|
|
||||||
|
.append("deleteflag", getDeleteflag())
|
||||||
|
|
||||||
|
.append("remark", getRemark())
|
||||||
|
|
||||||
|
.append("recordtime", getRecordtime())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.ruoyi.tyre.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.tyre.domain.BaseCarbrand;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌Mapper接口
|
||||||
|
*
|
||||||
|
* @author dhl
|
||||||
|
* @date 2020-03-26
|
||||||
|
*/
|
||||||
|
public interface BaseCarbrandMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询车牌
|
||||||
|
*
|
||||||
|
* @param objid 车牌ID
|
||||||
|
* @return 车牌
|
||||||
|
*/
|
||||||
|
public BaseCarbrand selectBaseCarbrandById(Long objid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车牌列表
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 车牌集合
|
||||||
|
*/
|
||||||
|
public List<BaseCarbrand> selectBaseCarbrandList(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBaseCarbrand(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBaseCarbrand(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车牌
|
||||||
|
*
|
||||||
|
* @param objid 车牌ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBaseCarbrandById(Long objid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除车牌
|
||||||
|
*
|
||||||
|
* @param objids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBaseCarbrandByIds(String[] objids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验车牌号码是否唯一
|
||||||
|
* @param branno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public BaseCarbrand checkBrannoUnique(String branno);
|
||||||
|
}
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.ruoyi.tyre.service;
|
||||||
|
|
||||||
|
import com.ruoyi.tyre.domain.BaseCarbrand;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*车牌Service接口
|
||||||
|
*
|
||||||
|
* @author dhl
|
||||||
|
* @date 2020-03-26
|
||||||
|
*/
|
||||||
|
public interface IBaseCarbrandService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询品牌
|
||||||
|
*
|
||||||
|
* @param objid车牌ID
|
||||||
|
* @return车牌
|
||||||
|
*/
|
||||||
|
public BaseCarbrand selectBaseCarbrandById(Long objid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询品牌列表
|
||||||
|
*
|
||||||
|
* @param baseCarbrand车牌
|
||||||
|
* @return车牌集合
|
||||||
|
*/
|
||||||
|
public List<BaseCarbrand> selectBaseCarbrandList(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增品牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertBaseCarbrand(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改品牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateBaseCarbrand(BaseCarbrand baseCarbrand);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除品牌
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBaseCarbrandByIds(String ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除品牌信息
|
||||||
|
*
|
||||||
|
* @param objid车牌ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBaseCarbrandById(Long objid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验车牌号码是否存在
|
||||||
|
* @param branno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String checkBrannoUnique(BaseCarbrand branno);
|
||||||
|
}
|
||||||
@ -0,0 +1,116 @@
|
|||||||
|
package com.ruoyi.tyre.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.common.constant.TyreConstants;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.SysPost;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.tyre.mapper.BaseCarbrandMapper;
|
||||||
|
import com.ruoyi.tyre.domain.BaseCarbrand;
|
||||||
|
import com.ruoyi.tyre.service.IBaseCarbrandService;
|
||||||
|
import com.ruoyi.common.core.text.Convert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车牌Service业务层处理
|
||||||
|
*
|
||||||
|
* @author dhl
|
||||||
|
* @date 2020-03-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class BaseCarbrandServiceImpl implements IBaseCarbrandService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private BaseCarbrandMapper baseCarbrandMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车牌
|
||||||
|
*
|
||||||
|
* @param objid 车牌ID
|
||||||
|
* @return 车牌
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BaseCarbrand selectBaseCarbrandById(Long objid)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.selectBaseCarbrandById(objid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车牌列表
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 车牌
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<BaseCarbrand> selectBaseCarbrandList(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.selectBaseCarbrandList(baseCarbrand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertBaseCarbrand(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.insertBaseCarbrand(baseCarbrand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车牌
|
||||||
|
*
|
||||||
|
* @param baseCarbrand 车牌
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateBaseCarbrand(BaseCarbrand baseCarbrand)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.updateBaseCarbrand(baseCarbrand);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车牌对象
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteBaseCarbrandByIds(String ids)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.deleteBaseCarbrandByIds(Convert.toStrArray(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验车牌号码是否唯一
|
||||||
|
* @param branno
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String checkBrannoUnique(BaseCarbrand branno) {
|
||||||
|
|
||||||
|
Long objId = StringUtils.isNull(branno.getObjid()) ? -1L : branno.getObjid();
|
||||||
|
BaseCarbrand info=baseCarbrandMapper.checkBrannoUnique(branno.getBranno());
|
||||||
|
if (StringUtils.isNotNull(info) && info.getObjid().longValue() != objId.longValue())
|
||||||
|
{
|
||||||
|
return TyreConstants.BRANNO_NOT_UNIQUE;//不唯一:1
|
||||||
|
}
|
||||||
|
return TyreConstants.BRANNO_UNIQUE;//唯一:0
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车牌信息
|
||||||
|
*
|
||||||
|
* @param objid 车牌ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteBaseCarbrandById(Long objid)
|
||||||
|
{
|
||||||
|
return baseCarbrandMapper.deleteBaseCarbrandById(objid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
<?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.ruoyi.tyre.mapper.BaseCarbrandMapper">
|
||||||
|
|
||||||
|
<resultMap type="BaseCarbrand" id="BaseCarbrandResult">
|
||||||
|
<result property="objid" column="ObjId" />
|
||||||
|
<result property="branno" column="BranNo" />
|
||||||
|
<result property="cartype" column="CarType" />
|
||||||
|
<result property="recorderid" column="RecorderID" />
|
||||||
|
<result property="deleteflag" column="DeleteFlag" />
|
||||||
|
<result property="remark" column="Remark" />
|
||||||
|
<result property="recordtime" column="RecordTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBaseCarbrandVo">
|
||||||
|
select ObjId, BranNo, CarType, RecorderID, DeleteFlag, Remark, RecordTime from base_carbrand
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBaseCarbrandList" parameterType="BaseCarbrand" resultMap="BaseCarbrandResult">
|
||||||
|
<include refid="selectBaseCarbrandVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="branno != null and branno != ''"> and BranNo = #{branno}</if>
|
||||||
|
<if test="cartype != null and cartype != ''"> and CarType = #{cartype}</if>
|
||||||
|
<if test="recorderid != null and recorderid != ''"> and RecorderID = #{recorderid}</if>
|
||||||
|
<if test="deleteflag != null and deleteflag != ''"> and DeleteFlag = #{deleteflag}</if>
|
||||||
|
<if test="remark != null and remark != ''"> and Remark = #{remark}</if>
|
||||||
|
<if test="recordtime != null "> and RecordTime = #{recordtime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBaseCarbrandById" parameterType="Long" resultMap="BaseCarbrandResult">
|
||||||
|
<include refid="selectBaseCarbrandVo"/>
|
||||||
|
where ObjId = #{objid}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBaseCarbrand" parameterType="BaseCarbrand">
|
||||||
|
insert into base_carbrand
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="objid != null ">ObjId,</if>
|
||||||
|
<if test="branno != null and branno != ''">BranNo,</if>
|
||||||
|
<if test="cartype != null and cartype != ''">CarType,</if>
|
||||||
|
<if test="recorderid != null ">RecorderID,</if>
|
||||||
|
<if test="deleteflag != null and deleteflag != ''">DeleteFlag,</if>
|
||||||
|
<if test="remark != null and remark != ''">Remark,</if>
|
||||||
|
<if test="recordtime != null ">RecordTime,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="objid != null ">#{objid},</if>
|
||||||
|
<if test="branno != null and branno != ''">#{branno},</if>
|
||||||
|
<if test="cartype != null and cartype != ''">#{cartype},</if>
|
||||||
|
<if test="recorderid != null ">#{recorderid},</if>
|
||||||
|
<if test="deleteflag != null and deleteflag != ''">#{deleteflag},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="recordtime != null ">#{recordtime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBaseCarbrand" parameterType="BaseCarbrand">
|
||||||
|
update base_carbrand
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="branno != null and branno != ''">BranNo = #{branno},</if>
|
||||||
|
<if test="cartype != null and cartype != ''">CarType = #{cartype},</if>
|
||||||
|
<if test="recorderid != null ">RecorderID = #{recorderid},</if>
|
||||||
|
<if test="deleteflag != null and deleteflag != ''">DeleteFlag = #{deleteflag},</if>
|
||||||
|
<if test="remark != null and remark != ''">Remark = #{remark},</if>
|
||||||
|
<if test="recordtime != null ">RecordTime = #{recordtime},</if>
|
||||||
|
</trim>
|
||||||
|
where ObjId = #{objid}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBaseCarbrandById" parameterType="Long">
|
||||||
|
delete from base_carbrand where ObjId = #{objid}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteBaseCarbrandByIds" parameterType="String">
|
||||||
|
delete from base_carbrand where ObjId in
|
||||||
|
<foreach item="objid" collection="array" open="(" separator="," close=")">
|
||||||
|
#{objid}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!--<select id="checkBrannoUnique" parameterType="String" resultType="int">-->
|
||||||
|
<!--select count(1) from base_carbrand where BranNo=#{branno}-->
|
||||||
|
<!--</select>-->
|
||||||
|
|
||||||
|
<select id="checkBrannoUnique" parameterType="String" resultMap="BaseCarbrandResult">
|
||||||
|
<include refid="selectBaseCarbrandVo"/>
|
||||||
|
where BranNo=#{branno}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue