第六次提交,增加轮胎品牌维护
parent
eb176c930d
commit
ac95ea4340
@ -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 |
@ -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> 搜索</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: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,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…
Reference in New Issue