第六次提交,增加轮胎品牌维护

master
duhl 6 years ago
parent eb176c930d
commit ac95ea4340

@ -50,6 +50,6 @@ public class SysIndexController extends BaseController
public String main(ModelMap mmap)
{
mmap.put("version", Global.getVersion());
return "main";
return "main_v1";
}
}

@ -29,7 +29,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* Controller
* Controller
*
* @author dhl
* @date 2020-03-26
@ -51,7 +51,7 @@ public class BaseCarbrandController extends BaseController
}
/**
*
*
*/
@RequiresPermissions("tyre:carbrand:list")
@PostMapping("/list")
@ -64,7 +64,7 @@ public class BaseCarbrandController extends BaseController
}
/**
*
*
*/
@RequiresPermissions("tyre:carbrand:export")
@Log(title = "车辆车牌", businessType = BusinessType.EXPORT)

@ -0,0 +1,154 @@
package com.ruoyi.web.controller.tyre;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.constant.TyreConstants;
import com.ruoyi.framework.util.ShiroUtils;
import com.ruoyi.tyre.domain.BaseCarbrand;
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.BaseTyreBrand;
import com.ruoyi.tyre.service.IBaseTyreBrandService;
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-30
*/
@Controller
@RequestMapping("/tyre/brand")
public class BaseTyreBrandController extends BaseController
{
private String prefix = "tyre/brand";
@Autowired
private IBaseTyreBrandService baseTyreBrandService;
@RequiresPermissions("tyre:brand:view")
@GetMapping()
public String brand()
{
return prefix + "/brand";
}
/**
*
*/
@RequiresPermissions("tyre:brand:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(BaseTyreBrand baseTyreBrand)
{
startPage();
List<BaseTyreBrand> list = baseTyreBrandService.selectBaseTyreBrandList(baseTyreBrand);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("tyre:brand:export")
@Log(title = "轮胎品牌信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(BaseTyreBrand baseTyreBrand)
{
List<BaseTyreBrand> list = baseTyreBrandService.selectBaseTyreBrandList(baseTyreBrand);
ExcelUtil<BaseTyreBrand> util = new ExcelUtil<BaseTyreBrand>(BaseTyreBrand.class);
return util.exportExcel(list, "brand");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("tyre:brand:add")
@Log(title = "轮胎品牌信息", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(BaseTyreBrand baseTyreBrand)
{
if(StringUtils.isBlank(baseTyreBrand.getBrandname())){
//轮胎品牌名称为空,给提示
return error("轮胎品牌不能为空");
}
if (TyreConstants.BRANNO_NOT_UNIQUE.equals(baseTyreBrandService.checkBranNameUnique(baseTyreBrand)))
{
return error("新增轮胎品牌'" + baseTyreBrand.getBrandname() + "'失败,轮胎品牌名称已存在");
}
baseTyreBrand.setRecorderid(ShiroUtils.getLoginName());//记录人信息
baseTyreBrand.setRecordtime(new Date());
return toAjax(baseTyreBrandService.insertBaseTyreBrand(baseTyreBrand));
}
/**
*
*/
@GetMapping("/edit/{objid}")
public String edit(@PathVariable("objid") Long objid, ModelMap mmap)
{
BaseTyreBrand baseTyreBrand = baseTyreBrandService.selectBaseTyreBrandById(objid);
mmap.put("baseTyreBrand", baseTyreBrand);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("tyre:brand:edit")
@Log(title = "轮胎品牌信息", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(BaseTyreBrand baseTyreBrand)
{
baseTyreBrand.setRecorderid(ShiroUtils.getLoginName());//记录人信息
baseTyreBrand.setRecordtime(new Date());
return toAjax(baseTyreBrandService.updateBaseTyreBrand(baseTyreBrand));
}
/**
*
*/
@RequiresPermissions("tyre:brand:remove")
@Log(title = "轮胎品牌信息", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(baseTyreBrandService.deleteBaseTyreBrandByIds(ids));
}
/**
*
*/
@PostMapping("/checkBranNameUnique")
@ResponseBody
public String checkBrannoUnique(BaseTyreBrand baseTyreBrand)
{
return baseTyreBrandService.checkBranNameUnique(baseTyreBrand);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<title>若依系统首页</title>
<title>智能轮胎系统</title>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html"/>
<![endif]-->
@ -29,7 +29,7 @@
<ul class="nav" id="side-menu">
<a th:href="@{/index}">
<li class="logo">
<span class="logo-lg" >RuoYi</span>
<span class="logo-lg" >智能轮胎管理系统</span>
</li>
</a>
<li>
@ -50,7 +50,7 @@
<li>
<a href="#"><i class="fa fa-home"></i> <span class="nav-label">主页</span> <span class="fa arrow"></span></a>
<ul class="nav nav-second-level">
<li><a class="menuItem" th:href="@{/system/main}">了解若依</a></li>
<li><a class="menuItem" th:href="@{/system/main}">首页</a></li>
</ul>
</li>
<li th:each="menu : ${menus}">
@ -175,9 +175,9 @@
</a>
</div>
<ul class="nav navbar-top-links navbar-right welcome-message">
<li><a title="阿里云双11" href="https://www.aliyun.com/1111/2019/group-buying-share?ptCode=79B1148C588D554F3E87264DB80E6C90647C88CF896EF535&userCode=brki8iof&share_source=copy_link" target="_blank"><i class="fa fa-cloud"></i> 阿里云双11</a></li>
<li><a title="视频教程" href="http://doc.ruoyi.vip/ruoyi/document/spjc.html" target="_blank"><i class="fa fa-video-camera"></i> 视频教程</a></li>
<li><a title="开发文档" href="http://doc.ruoyi.vip" target="_blank"><i class="fa fa-question-circle"></i> 开发文档</a></li>
<!--<li><a title="阿里云双11" href="https://www.aliyun.com/1111/2019/group-buying-share?ptCode=79B1148C588D554F3E87264DB80E6C90647C88CF896EF535&userCode=brki8iof&share_source=copy_link" target="_blank"><i class="fa fa-cloud"></i> 阿里云双11</a></li>-->
<!--<li><a title="视频教程" href="http://doc.ruoyi.vip/ruoyi/document/spjc.html" target="_blank"><i class="fa fa-video-camera"></i> 视频教程</a></li>-->
<!--<li><a title="开发文档" href="http://doc.ruoyi.vip" target="_blank"><i class="fa fa-question-circle"></i> 开发文档</a></li>-->
<li><a title="全屏显示" href="javascript:void(0)" id="fullScreen"><i class="fa fa-arrows-alt"></i> 全屏显示</a></li>
<li class="dropdown user-menu">
<a href="javascript:void(0)" class="dropdown-toggle" data-hover="dropdown">
@ -228,9 +228,9 @@
<iframe class="RuoYi_iframe" name="iframe0" width="100%" height="100%" data-id="/system/main"
th:src="@{/system/main}" frameborder="0" seamless></iframe>
</div>
<div class="footer">
<div class="pull-right">© [[${copyrightYear}]] RuoYi Copyright </div>
</div>
<!--<div class="footer">-->
<!--<div class="pull-right">© [[${copyrightYear}]] RuoYi Copyright </div>-->
<!--</div>-->
</div>
<!--右侧部分结束-->
</div>

@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>登录若依系统</title>
<meta name="description" content="若依后台管理框架">
<title>登录智能轮胎系统</title>
<meta name="description" content="智能轮胎系统">
<link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
<link href="../static/css/style.css" th:href="@{/css/style.css}" rel="stylesheet"/>
@ -25,27 +25,27 @@
<div class="signinpanel">
<div class="row">
<div class="col-sm-7">
<div class="col-sm-6">
<div class="signin-info">
<div class="logopanel m-b">
<h1><img alt="[ 若依 ]" src="../static/ruoyi.png" th:src="@{/ruoyi.png}"></h1>
</div>
<div class="m-b"></div>
<h4>欢迎使用 <strong>若依 后台管理系统</strong></h4>
<ul class="m-b">
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Shiro</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>
<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>
</ul>
<strong>还没有账号? <a href="#">立即注册&raquo;</a></strong>
<!--<div class="logopanel m-b">-->
<h1><img alt="[ 智能轮胎 ]" src="../static/tyre.jpg" th:src="@{/img/tyre.jpg}"></h1>
<!--</div>-->
<!--<div class="m-b"></div>-->
<!--<h4>欢迎使用 <strong>智能轮胎后台管理系统</strong></h4>-->
<!--<ul class="m-b">-->
<!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> SpringBoot</li>-->
<!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Mybatis</li>-->
<!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Shiro</li>-->
<!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Thymeleaf</li>-->
<!--<li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> Bootstrap</li>-->
<!--</ul>-->
<!--<strong>还没有账号? <a href="#">立即注册&raquo;</a></strong>-->
</div>
</div>
<div class="col-sm-5">
<div class="col-sm-6">
<form id="signupForm">
<h4 class="no-margins">登录:</h4>
<p class="m-t-md">你若不离不弃,我必生死相依</p>
<h1 class="no-margins">智能轮胎系统登录:</h1>
<input type="text" name="username" class="form-control uname" placeholder="用户名" value="admin" />
<input type="password" name="password" class="form-control pword" placeholder="密码" value="admin123" />
<div class="row m-t" th:if="${captchaEnabled==true}">
@ -65,11 +65,11 @@
</form>
</div>
</div>
<div class="signup-footer">
<div class="pull-left">
&copy; 2019 All Rights Reserved. RuoYi <br>
</div>
</div>
<!--<div class="signup-footer">-->
<!--<div class="pull-left">-->
<!--&copy; 2019 All Rights Reserved. RuoYi <br>-->
<!--</div>-->
<!--</div>-->
</div>
<script th:inline="javascript"> var ctx = [[@{/}]]; var captchaType = [[${captchaType}]]; </script>
<!-- 全局js -->

@ -0,0 +1,81 @@
<!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-brand-add">
<div class="form-group">
<label class="col-sm-3 control-label"><span style="color: red; ">*</span>轮胎品牌名称:</label>
<div class="col-sm-8">
<input name="brandname" id="brandname" 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">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_job_status')}">
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</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/brand"
$("#form-brand-add").validate({
onkeyup: false,
rules:{
brandname:{
remote: {
url: prefix + "/checkBranNameUnique",
type: "post",
dataType: "json",
data: {
"branno": function() {
return $.common.trim($("#brandname").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
}
},
messages: {
"brandname": {
remote: "轮胎品牌已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-brand-add').serialize());
}
}
$("input[name='recordtime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,119 @@
<!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="brandname"/>
</li>
<li class="select-time">
<label>记录时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endTime]"/>
</li>
<li>
状态:
<select name="status" th:with="type=${@dict.getType('sys_job_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</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:brand:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="tyre:brand:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tyre:brand:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="tyre:brand: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:brand:edit')}]];
var removeFlag = [[${@permission.hasPermi('tyre:brand:remove')}]];
var statusDatas = [[${@dict.getType('sys_job_status')}]];
var prefix = ctx + "tyre/brand";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
sortName: "recordtime",
sortOrder: "desc",
modalName: "轮胎品牌信息",
columns: [{
checkbox: true
},
{
field : 'brandname',
title : '轮胎品牌名称',
sortable: true
},
{
field : 'recorderid',
title : '记录人'
},
{
field : 'remark',
title : '备注'
},
{
field : 'recordtime',
title : '记录时间',
sortable: true
},
{
field : 'status',
title : '状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
},
{
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,85 @@
<!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-brand-edit" th:object="${baseTyreBrand}">
<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="brandname" id="brandname" th:field="*{brandname}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('sys_job_status')}">
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</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/brand";
$("#form-brand-edit").validate({
onkeyup: false,
rules:{
brandname:{
remote: {
url: prefix + "/checkBranNameUnique",
type: "post",
dataType: "json",
data: {
"objid": function() {
return $("input[name='objid']").val();
},
"branno": function() {
return $.common.trim($("#brandname").val());
}
},
dataFilter: function(data, type) {
return $.validate.unique(data);
}
}
}
},
messages: {
"brandname": {
remote: "轮胎品牌已经存在"
}
},
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-brand-edit').serialize());
}
}
$("input[name='recordtime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,102 @@
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 java.util.Date;
/**
* base_tyre_brand
*
* @author dhl
* @date 2020-03-30
*/
public class BaseTyreBrand extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 轮胎品牌ID */
@Excel(name = "轮胎品牌ID")
private Long objid;
/** 轮胎品牌名称 */
@Excel(name = "轮胎品牌名称")
private String brandname;
/** 记录人 */
@Excel(name = "记录人")
private String recorderid;
/** 记录时间 */
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date recordtime;
/** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
public void setObjid(Long objid)
{
this.objid = objid;
}
public Long getObjid()
{
return objid;
}
public void setBrandname(String brandname)
{
this.brandname = brandname;
}
public String getBrandname()
{
return brandname;
}
public void setRecorderid(String recorderid)
{
this.recorderid = recorderid;
}
public String getRecorderid()
{
return recorderid;
}
public void setRecordtime(Date recordtime)
{
this.recordtime = recordtime;
}
public Date getRecordtime()
{
return recordtime;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("objid", getObjid())
.append("brandname", getBrandname())
.append("recorderid", getRecorderid())
.append("remark", getRemark())
.append("recordtime", getRecordtime())
.append("status", getStatus())
.toString();
}
}

@ -0,0 +1,64 @@
package com.ruoyi.tyre.mapper;
import com.ruoyi.tyre.domain.BaseCarbrand;
import com.ruoyi.tyre.domain.BaseTyreBrand;
import java.util.List;
/**
* Mapper
*
* @author dhl
* @date 2020-03-30
*/
public interface BaseTyreBrandMapper
{
/**
*
*
* @param objid ID
* @return
*/
public BaseTyreBrand selectBaseTyreBrandById(Long objid);
/**
*
*
* @param baseTyreBrand
* @return
*/
public List<BaseTyreBrand> selectBaseTyreBrandList(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param baseTyreBrand
* @return
*/
public int insertBaseTyreBrand(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param baseTyreBrand
* @return
*/
public int updateBaseTyreBrand(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param objid ID
* @return
*/
public int deleteBaseTyreBrandById(Long objid);
/**
*
*
* @param objids ID
* @return
*/
public int deleteBaseTyreBrandByIds(String[] objids);
public BaseTyreBrand checkBranNameUnique(String brandname);
}

@ -0,0 +1,63 @@
package com.ruoyi.tyre.service;
import com.ruoyi.tyre.domain.BaseTyreBrand;
import java.util.List;
/**
* Service
*
* @author dhl
* @date 2020-03-30
*/
public interface IBaseTyreBrandService
{
/**
*
*
* @param objid ID
* @return
*/
public BaseTyreBrand selectBaseTyreBrandById(Long objid);
/**
*
*
* @param baseTyreBrand
* @return
*/
public List<BaseTyreBrand> selectBaseTyreBrandList(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param baseTyreBrand
* @return
*/
public int insertBaseTyreBrand(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param baseTyreBrand
* @return
*/
public int updateBaseTyreBrand(BaseTyreBrand baseTyreBrand);
/**
*
*
* @param ids ID
* @return
*/
public int deleteBaseTyreBrandByIds(String ids);
/**
*
*
* @param objid ID
* @return
*/
public int deleteBaseTyreBrandById(Long objid);
public String checkBranNameUnique(BaseTyreBrand baseTyreBrand);
}

@ -0,0 +1,114 @@
package com.ruoyi.tyre.service.impl;
import java.util.List;
import com.ruoyi.common.constant.TyreConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.tyre.domain.BaseCarbrand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tyre.mapper.BaseTyreBrandMapper;
import com.ruoyi.tyre.domain.BaseTyreBrand;
import com.ruoyi.tyre.service.IBaseTyreBrandService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author dhl
* @date 2020-03-30
*/
@Service
public class BaseTyreBrandServiceImpl implements IBaseTyreBrandService
{
@Autowired
private BaseTyreBrandMapper baseTyreBrandMapper;
/**
*
*
* @param objid ID
* @return
*/
@Override
public BaseTyreBrand selectBaseTyreBrandById(Long objid)
{
return baseTyreBrandMapper.selectBaseTyreBrandById(objid);
}
/**
*
*
* @param baseTyreBrand
* @return
*/
@Override
public List<BaseTyreBrand> selectBaseTyreBrandList(BaseTyreBrand baseTyreBrand)
{
return baseTyreBrandMapper.selectBaseTyreBrandList(baseTyreBrand);
}
/**
*
*
* @param baseTyreBrand
* @return
*/
@Override
public int insertBaseTyreBrand(BaseTyreBrand baseTyreBrand)
{
return baseTyreBrandMapper.insertBaseTyreBrand(baseTyreBrand);
}
/**
*
*
* @param baseTyreBrand
* @return
*/
@Override
public int updateBaseTyreBrand(BaseTyreBrand baseTyreBrand)
{
return baseTyreBrandMapper.updateBaseTyreBrand(baseTyreBrand);
}
/**
*
*
* @param ids ID
* @return
*/
@Override
public int deleteBaseTyreBrandByIds(String ids)
{
return baseTyreBrandMapper.deleteBaseTyreBrandByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param objid ID
* @return
*/
public int deleteBaseTyreBrandById(Long objid)
{
return baseTyreBrandMapper.deleteBaseTyreBrandById(objid);
}
/**
*
* @param baseTyreBrand
* @return
*/
@Override
public String checkBranNameUnique(BaseTyreBrand baseTyreBrand) {
Long objId = StringUtils.isNull(baseTyreBrand.getObjid()) ? -1L : baseTyreBrand.getObjid();
BaseTyreBrand info=baseTyreBrandMapper.checkBranNameUnique(baseTyreBrand.getBrandname());
if (StringUtils.isNotNull(info) && info.getObjid().longValue() != objId.longValue())
{
return TyreConstants.BRANNO_NOT_UNIQUE;//不唯一:1
}
return TyreConstants.BRANNO_UNIQUE;//唯一:0
}
}

@ -0,0 +1,94 @@
<?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.BaseTyreBrandMapper">
<resultMap type="BaseTyreBrand" id="BaseTyreBrandResult">
<result property="objid" column="ObjId" />
<result property="brandname" column="BrandName" />
<result property="recorderid" column="RecorderID" />
<result property="remark" column="Remark" />
<result property="recordtime" column="RecordTime" />
<result property="status" column="Status" />
</resultMap>
<sql id="selectBaseTyreBrandVo">
select ObjId, BrandName, RecorderID, Remark, RecordTime, Status from base_tyre_brand
</sql>
<select id="selectBaseTyreBrandList" parameterType="BaseTyreBrand" resultMap="BaseTyreBrandResult">
<include refid="selectBaseTyreBrandVo"/>
<where>
<if test="objid != null "> and ObjId = #{objid}</if>
<if test="brandname != null and brandname != ''">
AND BrandName like '%'+#{brandname}+ '%'
</if>
<if test="recorderid != null and recorderid != ''"> and RecorderID like concat('%', #{recorderid}, '%')</if>
<if test="remark != null and remark != ''"> and Remark = #{remark}</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND datediff(dd,#{params.beginTime},recordtime)>=0
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND datediff(dd,recordtime,#{params.endTime})>=0
</if>
<if test="recordtime != null "> and RecordTime = #{recordtime}</if>
<if test="status != null and status != ''"> and Status = #{status}</if>
</where>
</select>
<select id="selectBaseTyreBrandById" parameterType="Long" resultMap="BaseTyreBrandResult">
<include refid="selectBaseTyreBrandVo"/>
where ObjId = #{objid}
</select>
<insert id="insertBaseTyreBrand" parameterType="BaseTyreBrand">
insert into base_tyre_brand
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objid != null ">ObjId,</if>
<if test="brandname != null and brandname != ''">BrandName,</if>
<if test="recorderid != null and recorderid != ''">RecorderID,</if>
<if test="remark != null and remark != ''">Remark,</if>
<if test="recordtime != null ">RecordTime,</if>
<if test="status != null and status != ''">Status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objid != null ">#{objid},</if>
<if test="brandname != null and brandname != ''">#{brandname},</if>
<if test="recorderid != null and recorderid != ''">#{recorderid},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="recordtime != null ">#{recordtime},</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
<update id="updateBaseTyreBrand" parameterType="BaseTyreBrand">
update base_tyre_brand
<trim prefix="SET" suffixOverrides=",">
<if test="brandname != null and brandname != ''">BrandName = #{brandname},</if>
<if test="recorderid != null and recorderid != ''">RecorderID = #{recorderid},</if>
<if test="remark != null and remark != ''">Remark = #{remark},</if>
<if test="recordtime != null ">RecordTime = #{recordtime},</if>
<if test="status != null and status != ''">Status = #{status},</if>
</trim>
where ObjId = #{objid}
</update>
<delete id="deleteBaseTyreBrandById" parameterType="Long">
delete from base_tyre_brand where ObjId = #{objid}
</delete>
<delete id="deleteBaseTyreBrandByIds" parameterType="String">
delete from base_tyre_brand where ObjId in
<foreach item="objid" collection="array" open="(" separator="," close=")">
#{objid}
</foreach>
</delete>
<select id="checkBranNameUnique" parameterType="String" resultMap="BaseTyreBrandResult">
<include refid="selectBaseTyreBrandVo"/>
where BrandName=#{brandname}
</select>
</mapper>
Loading…
Cancel
Save