第一次提交,完成车牌车辆维护

master
duhl 6 years ago
parent 1d4bb42155
commit ac79b89673

@ -213,7 +213,8 @@
<module>ruoyi-quartz</module>
<module>ruoyi-generator</module>
<module>ruoyi-common</module>
</modules>
<module>ruoyi-tyre</module>
</modules>
<packaging>pom</packaging>

@ -72,7 +72,18 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-generator</artifactId>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-system</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-tyre</artifactId>
<version>4.1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

@ -224,6 +224,7 @@ public class SysUserController extends BaseController
@ResponseBody
public String checkLoginNameUnique(SysUser user)
{
return userService.checkLoginNameUnique(user.getLoginName());
}

@ -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);
}
}

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=ry
url: jdbc:sqlserver://47.96.6.167:1433;SelectMethod=cursor;DatabaseName=TyreDB
username: sa
password: 123456
password: haiwei@123
# 从库数据源
slave:
# 从数据源开关/默认关闭
@ -21,7 +21,7 @@ spring:
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
maxActive: 30
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒

@ -16,7 +16,7 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口默认为80
port: 80
port: 8090
servlet:
# 应用的访问路径
context-path: /

@ -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>&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: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";
}

@ -2,9 +2,9 @@
# 代码生成
gen:
# 作者
author: ruoyi
author: dhl
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: com.ruoyi.system
packageName: com.ruoyi.tyre
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)

@ -64,4 +64,6 @@ public interface SysJobMapper
* @return
*/
public int insertJob(SysJob job);
}

@ -99,4 +99,5 @@ public interface ISysJobService
* @return
*/
public boolean checkCronExpressionIsValid(String cronExpression);
}

@ -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 objidID
* @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 objidID
* @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…
Cancel
Save