车型与套餐

This commit is contained in:
19173159168
2025-07-14 22:02:16 +08:00
parent f0812d0cba
commit e81e401407
23 changed files with 2030 additions and 10 deletions

View File

@ -77,6 +77,14 @@ public class CompanyController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取所有运营商
*/
@GetMapping("/companyAll")
@ResponseBody
public List<Company> companyAll() {
return companyService.selectCompanyList(new Company());
}
/** /**
* 导出运营商列表 * 导出运营商列表
*/ */

View File

@ -11,11 +11,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
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.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.operation.domain.CompanyStore; import com.ruoyi.operation.domain.CompanyStore;
@ -68,6 +64,16 @@ public class CompanyStoreController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* 获取某运营商下的门店
*/
@PostMapping("/storesByCompanyId")
@ResponseBody
public List<CompanyStore> getStores(@RequestParam Long companyId) {
CompanyStore companyStore = new CompanyStore();
companyStore.setOperatingCompanyId(companyId);
return companyStoreService.selectCompanyStoreList(companyStore);
}
/** /**
* 导出门店列表 * 导出门店列表
*/ */

View File

@ -0,0 +1,151 @@
package com.ruoyi.operation.controller;
import java.util.List;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.operation.domain.Company;
import com.ruoyi.operation.service.ICompanyService;
import com.ruoyi.operation.util.OperationConstants;
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.operation.domain.ZcCar;
import com.ruoyi.operation.service.IZcCarService;
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 ruoyi
* @date 2025-07-13
*/
@Controller
@RequestMapping("/operation/car")
public class ZcCarController extends BaseController
{
private String prefix = "operation/car";
@Autowired
private IZcCarService zcCarService;
@Autowired
private ICompanyService companyService;
@RequiresPermissions("operation:car:view")
@GetMapping()
public String car()
{
return prefix + "/car";
}
/**
* 查询车型管理列表
*/
@RequiresPermissions("operation:car:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ZcCar zcCar)
{
startPage();
List<ZcCar> list = zcCarService.selectZcCarList(zcCar);
return getDataTable(list);
}
/**
* 导出车型管理列表
*/
@RequiresPermissions("operation:car:export")
@Log(title = "车型管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ZcCar zcCar)
{
List<ZcCar> list = zcCarService.selectZcCarList(zcCar);
ExcelUtil<ZcCar> util = new ExcelUtil<ZcCar>(ZcCar.class);
return util.exportExcel(list, "车型管理数据");
}
/**
* 新增车型管理
*/
@GetMapping("/add")
public String add(ModelMap mmap)
{
List<Company> companyList = companyService.getCompanyList(new Company(),getSysUser()); // 获取运营商列表
mmap.put("companyList", companyList); // 将运营商列表传递到前端
return prefix + "/add";
}
/**
* 新增保存车型管理
*/
@RequiresPermissions("operation:car:add")
@Log(title = "车型管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ZcCar zcCar)
{
// 校验 VIN 是否唯一
if (StringUtils.isNotEmpty(zcCar.getVin())
&& OperationConstants.USER_VIN_NOT_UNIQUE.equals(zcCarService.checkVinUnique(zcCar))) {
return error("新增失败,车机号已存在");
}
return toAjax(zcCarService.insertZcCar(zcCar));
}
/**
* 修改车型管理
*/
@RequiresPermissions("operation:car:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
List<Company> companyList = companyService.getCompanyList(new Company(),getSysUser()); // 获取运营商列表
mmap.put("companyList", companyList); // 将运营商列表传递到前端
ZcCar zcCar = zcCarService.selectZcCarById(id);
mmap.put("zcCar", zcCar);
return prefix + "/edit";
}
/**
* 修改保存车型管理
*/
@RequiresPermissions("operation:car:edit")
@Log(title = "车型管理", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ZcCar zcCar)
{
// 校验 VIN 是否唯一
if (StringUtils.isNotEmpty(zcCar.getVin())
&& OperationConstants.USER_VIN_NOT_UNIQUE.equals(zcCarService.checkVinUnique(zcCar))) {
return error("修改失败,车机号已存在");
}
return toAjax(zcCarService.updateZcCar(zcCar));
}
/**
* 删除车型管理
*/
@RequiresPermissions("operation:car:remove")
@Log(title = "车型管理", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(zcCarService.deleteZcCarByIds(ids));
}
}

View File

@ -150,4 +150,17 @@ public class ZcCarModelController extends BaseController
return toAjax(zcCarModelService.changeStatus(zcCarModel)); return toAjax(zcCarModelService.changeStatus(zcCarModel));
} }
@GetMapping("/brands")
@ResponseBody
public List<String> getBrands() {
return zcCarModelService.selectAllBrands();
}
@PostMapping("/getModels")
@ResponseBody
public List<String> getModels(String brandName) {
return zcCarModelService.selectModelsByBrand(brandName);
}
} }

View File

@ -72,7 +72,6 @@ public class CompanyStore extends BaseEntity
private String detailedAddress; private String detailedAddress;
/** 门店logo */ /** 门店logo */
@Excel(name = "门店logo")
private String image; private String image;
/** 纬度 */ /** 纬度 */

View File

@ -0,0 +1,460 @@
package com.ruoyi.operation.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
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;
/**
* 车型管理对象 zc_car
*
* @author ruoyi
* @date 2025-07-13
*/
public class ZcCar extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 车架号(VIN) */
@Excel(name = "车架号(VIN)")
private String vin;
/** 车牌号码 */
@Excel(name = "车牌号码")
private String licensePlate;
/** 车辆品牌ID */
@Excel(name = "车辆品牌ID")
private Long brandId;
/** 车辆品牌名称 */
@Excel(name = "车辆品牌名称")
private String brandName;
/** 车辆型号ID */
@Excel(name = "车辆型号ID")
private Long modelId;
/** 车辆型号名称 */
@Excel(name = "车辆型号名称")
private String modelName;
/** 支持电池类型 */
@Excel(name = "支持电池类型")
private String batteryType;
/** 整车重量(kg) */
@Excel(name = "整车重量(kg)")
private String weight;
/** 最高时速(km/h) */
@Excel(name = "最高时速(km/h)")
private String maxSpeed;
/** LOT识别号 */
@Excel(name = "LOT识别号")
private String lotNumber;
/** 采购日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "采购日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date purchaseDate;
/** 采购价格(元) */
@Excel(name = "采购价格(元)")
private BigDecimal purchasePrice;
/** 车辆归属 */
@Excel(name = "车辆归属")
private String belongType;
/** 车辆图片 */
@Excel(name = "车辆图片")
private String images;
/** BRS车辆状态 */
@Excel(name = "BRS车辆状态")
private String brsStatus;
/** IoT设备状态 */
@Excel(name = "IoT设备状态")
private String iotStatus;
/** IoT识别码 */
@Excel(name = "IoT识别码")
private String iotCode;
/** 所属运营商ID */
@Excel(name = "所属运营商ID")
private Long operatorId;
/** 所属运营商名称 */
@Excel(name = "所属运营商名称")
private String operatorName;
/** 所属门店ID */
@Excel(name = "所属门店ID")
private Long storeId;
/** 所属门店名称 */
@Excel(name = "所属门店名称")
private String storeName;
/** 应用套餐ID */
@Excel(name = "应用套餐ID")
private Long packageId;
/** 应用套餐名称 */
@Excel(name = "应用套餐名称")
private String packageName;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 删除标志 */
private String delFlag;
/** 扩展字段1 */
private String extend1;
/** 扩展字段2 */
private String extend2;
/** 扩展字段3 */
private String extend3;
/** 扩展字段4 */
private String extend4;
/** 扩展字段5 */
private String extend5;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setVin(String vin)
{
this.vin = vin;
}
public String getVin()
{
return vin;
}
public void setLicensePlate(String licensePlate)
{
this.licensePlate = licensePlate;
}
public String getLicensePlate()
{
return licensePlate;
}
public void setBrandId(Long brandId)
{
this.brandId = brandId;
}
public Long getBrandId()
{
return brandId;
}
public void setBrandName(String brandName)
{
this.brandName = brandName;
}
public String getBrandName()
{
return brandName;
}
public void setModelId(Long modelId)
{
this.modelId = modelId;
}
public Long getModelId()
{
return modelId;
}
public void setModelName(String modelName)
{
this.modelName = modelName;
}
public String getModelName()
{
return modelName;
}
public void setBatteryType(String batteryType)
{
this.batteryType = batteryType;
}
public String getBatteryType()
{
return batteryType;
}
public void setWeight(String weight)
{
this.weight = weight;
}
public String getWeight()
{
return weight;
}
public void setMaxSpeed(String maxSpeed)
{
this.maxSpeed = maxSpeed;
}
public String getMaxSpeed()
{
return maxSpeed;
}
public void setLotNumber(String lotNumber)
{
this.lotNumber = lotNumber;
}
public String getLotNumber()
{
return lotNumber;
}
public void setPurchaseDate(Date purchaseDate)
{
this.purchaseDate = purchaseDate;
}
public Date getPurchaseDate()
{
return purchaseDate;
}
public void setPurchasePrice(BigDecimal purchasePrice)
{
this.purchasePrice = purchasePrice;
}
public BigDecimal getPurchasePrice()
{
return purchasePrice;
}
public void setBelongType(String belongType)
{
this.belongType = belongType;
}
public String getBelongType()
{
return belongType;
}
public void setImages(String images)
{
this.images = images;
}
public String getImages()
{
return images;
}
public void setBrsStatus(String brsStatus)
{
this.brsStatus = brsStatus;
}
public String getBrsStatus()
{
return brsStatus;
}
public void setIotStatus(String iotStatus)
{
this.iotStatus = iotStatus;
}
public String getIotStatus()
{
return iotStatus;
}
public void setIotCode(String iotCode)
{
this.iotCode = iotCode;
}
public String getIotCode()
{
return iotCode;
}
public void setOperatorId(Long operatorId)
{
this.operatorId = operatorId;
}
public Long getOperatorId()
{
return operatorId;
}
public void setOperatorName(String operatorName)
{
this.operatorName = operatorName;
}
public String getOperatorName()
{
return operatorName;
}
public void setStoreId(Long storeId)
{
this.storeId = storeId;
}
public Long getStoreId()
{
return storeId;
}
public void setStoreName(String storeName)
{
this.storeName = storeName;
}
public String getStoreName()
{
return storeName;
}
public void setPackageId(Long packageId)
{
this.packageId = packageId;
}
public Long getPackageId()
{
return packageId;
}
public void setPackageName(String packageName)
{
this.packageName = packageName;
}
public String getPackageName()
{
return packageName;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setExtend1(String extend1)
{
this.extend1 = extend1;
}
public String getExtend1()
{
return extend1;
}
public void setExtend2(String extend2)
{
this.extend2 = extend2;
}
public String getExtend2()
{
return extend2;
}
public void setExtend3(String extend3)
{
this.extend3 = extend3;
}
public String getExtend3()
{
return extend3;
}
public void setExtend4(String extend4)
{
this.extend4 = extend4;
}
public String getExtend4()
{
return extend4;
}
public void setExtend5(String extend5)
{
this.extend5 = extend5;
}
public String getExtend5()
{
return extend5;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("vin", getVin())
.append("licensePlate", getLicensePlate())
.append("brandId", getBrandId())
.append("brandName", getBrandName())
.append("modelId", getModelId())
.append("modelName", getModelName())
.append("batteryType", getBatteryType())
.append("weight", getWeight())
.append("maxSpeed", getMaxSpeed())
.append("lotNumber", getLotNumber())
.append("purchaseDate", getPurchaseDate())
.append("purchasePrice", getPurchasePrice())
.append("belongType", getBelongType())
.append("images", getImages())
.append("brsStatus", getBrsStatus())
.append("iotStatus", getIotStatus())
.append("iotCode", getIotCode())
.append("operatorId", getOperatorId())
.append("operatorName", getOperatorName())
.append("storeId", getStoreId())
.append("storeName", getStoreName())
.append("packageId", getPackageId())
.append("packageName", getPackageName())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("extend1", getExtend1())
.append("extend2", getExtend2())
.append("extend3", getExtend3())
.append("extend4", getExtend4())
.append("extend5", getExtend5())
.toString();
}
}

View File

@ -41,6 +41,8 @@ public class ZcCarModel extends BaseEntity
/** 整车重量(kg) */ /** 整车重量(kg) */
private BigDecimal weight; private BigDecimal weight;
private String image;
/** 状态0正常 1停用 */ /** 状态0正常 1停用 */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用") @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status; private String status;
@ -177,6 +179,14 @@ public class ZcCarModel extends BaseEntity
this.rentCarRuleList = rentCarRuleList; this.rentCarRuleList = rentCarRuleList;
} }
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -187,6 +197,7 @@ public class ZcCarModel extends BaseEntity
.append("batteryType", getBatteryType()) .append("batteryType", getBatteryType())
.append("maxSpeed", getMaxSpeed()) .append("maxSpeed", getMaxSpeed())
.append("weight", getWeight()) .append("weight", getWeight())
.append("image", getImage())
.append("status", getStatus()) .append("status", getStatus())
.append("delFlag", getDelFlag()) .append("delFlag", getDelFlag())
.append("createBy", getCreateBy()) .append("createBy", getCreateBy())

View File

@ -0,0 +1,63 @@
package com.ruoyi.operation.mapper;
import java.util.List;
import com.ruoyi.operation.domain.ZcCar;
/**
* 车型管理Mapper接口
*
* @author ruoyi
* @date 2025-07-13
*/
public interface ZcCarMapper
{
/**
* 查询车型管理
*
* @param id 车型管理主键
* @return 车型管理
*/
public ZcCar selectZcCarById(Long id);
/**
* 查询车型管理列表
*
* @param zcCar 车型管理
* @return 车型管理集合
*/
public List<ZcCar> selectZcCarList(ZcCar zcCar);
/**
* 新增车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
public int insertZcCar(ZcCar zcCar);
/**
* 修改车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
public int updateZcCar(ZcCar zcCar);
/**
* 删除车型管理
*
* @param id 车型管理主键
* @return 结果
*/
public int deleteZcCarById(Long id);
/**
* 批量删除车型管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteZcCarByIds(String[] ids);
public ZcCar checkVinUnique(String vin);
}

View File

@ -58,4 +58,9 @@ public interface ZcCarModelMapper
* @return 结果 * @return 结果
*/ */
public int deleteZcCarModelByIds(String[] ids); public int deleteZcCarModelByIds(String[] ids);
public List<String> selectAllBrands();
public List<String> selectModelsByBrand(String brandName);
} }

View File

@ -64,4 +64,14 @@ public interface IZcCarModelService
public int changeStatus(ZcCarModel zcCarModel); public int changeStatus(ZcCarModel zcCarModel);
/**
* 查询所有品牌
*/
List<String> selectAllBrands();
/**
* 根据品牌查询车型列表
*/
List<String> selectModelsByBrand(String brandName);
} }

View File

@ -0,0 +1,69 @@
package com.ruoyi.operation.service;
import java.util.List;
import com.ruoyi.operation.domain.ZcCar;
/**
* 车型管理Service接口
*
* @author ruoyi
* @date 2025-07-13
*/
public interface IZcCarService
{
/**
* 查询车型管理
*
* @param id 车型管理主键
* @return 车型管理
*/
public ZcCar selectZcCarById(Long id);
/**
* 查询车型管理列表
*
* @param zcCar 车型管理
* @return 车型管理集合
*/
public List<ZcCar> selectZcCarList(ZcCar zcCar);
/**
* 新增车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
public int insertZcCar(ZcCar zcCar);
/**
* 修改车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
public int updateZcCar(ZcCar zcCar);
/**
* 批量删除车型管理
*
* @param ids 需要删除的车型管理主键集合
* @return 结果
*/
public int deleteZcCarByIds(String ids);
/**
* 删除车型管理信息
*
* @param id 车型管理主键
* @return 结果
*/
public int deleteZcCarById(Long id);
/**
* 校验车机号 (VIN) 是否唯一
*
* @return 是否唯一 (0:唯一, 1:不唯一)
*/
String checkVinUnique(ZcCar zcCar);
}

View File

@ -147,4 +147,15 @@ public class ZcCarModelServiceImpl implements IZcCarModelService
return zcCarModelMapper.updateZcCarModel(zcCarModel); return zcCarModelMapper.updateZcCarModel(zcCarModel);
} }
@Override
public List<String> selectAllBrands() {
return zcCarModelMapper.selectAllBrands();
}
@Override
public List<String> selectModelsByBrand(String brandName) {
return zcCarModelMapper.selectModelsByBrand(brandName);
}
} }

View File

@ -0,0 +1,109 @@
package com.ruoyi.operation.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.operation.util.OperationConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.operation.mapper.ZcCarMapper;
import com.ruoyi.operation.domain.ZcCar;
import com.ruoyi.operation.service.IZcCarService;
import com.ruoyi.common.core.text.Convert;
/**
* 车型管理Service业务层处理
*
* @author ruoyi
* @date 2025-07-13
*/
@Service
public class ZcCarServiceImpl implements IZcCarService
{
@Autowired
private ZcCarMapper zcCarMapper;
/**
* 查询车型管理
*
* @param id 车型管理主键
* @return 车型管理
*/
@Override
public ZcCar selectZcCarById(Long id)
{
return zcCarMapper.selectZcCarById(id);
}
/**
* 查询车型管理列表
*
* @param zcCar 车型管理
* @return 车型管理
*/
@Override
public List<ZcCar> selectZcCarList(ZcCar zcCar)
{
return zcCarMapper.selectZcCarList(zcCar);
}
/**
* 新增车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
@Override
public int insertZcCar(ZcCar zcCar)
{
zcCar.setCreateTime(DateUtils.getNowDate());
return zcCarMapper.insertZcCar(zcCar);
}
/**
* 修改车型管理
*
* @param zcCar 车型管理
* @return 结果
*/
@Override
public int updateZcCar(ZcCar zcCar)
{
zcCar.setUpdateTime(DateUtils.getNowDate());
return zcCarMapper.updateZcCar(zcCar);
}
/**
* 批量删除车型管理
*
* @param ids 需要删除的车型管理主键
* @return 结果
*/
@Override
public int deleteZcCarByIds(String ids)
{
return zcCarMapper.deleteZcCarByIds(Convert.toStrArray(ids));
}
/**
* 删除车型管理信息
*
* @param id 车型管理主键
* @return 结果
*/
@Override
public int deleteZcCarById(Long id)
{
return zcCarMapper.deleteZcCarById(id);
}
@Override
public String checkVinUnique(ZcCar zcCar) {
Long carId = StringUtils.isNull(zcCar.getId()) ? -1L : zcCar.getId();
ZcCar info = zcCarMapper.checkVinUnique(zcCar.getVin());
if (StringUtils.isNotNull(info) && info.getId().longValue() != carId.longValue()){
return OperationConstants.USER_VIN_NOT_UNIQUE;
}
return OperationConstants.USER_VIN_UNIQUE;
}
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.operation.util;
public class OperationConstants {
/**
* 车机号 (VIN) 唯一
*/
public static final String USER_VIN_UNIQUE = "0";
public static final String USER_VIN_NOT_UNIQUE = "1";
}

View File

@ -0,0 +1,220 @@
<?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.operation.mapper.ZcCarMapper">
<resultMap type="ZcCar" id="ZcCarResult">
<result property="id" column="id" />
<result property="vin" column="vin" />
<result property="licensePlate" column="license_plate" />
<result property="brandId" column="brand_id" />
<result property="brandName" column="brand_name" />
<result property="modelId" column="model_id" />
<result property="modelName" column="model_name" />
<result property="batteryType" column="battery_type" />
<result property="weight" column="weight" />
<result property="maxSpeed" column="max_speed" />
<result property="lotNumber" column="lot_number" />
<result property="purchaseDate" column="purchase_date" />
<result property="purchasePrice" column="purchase_price" />
<result property="belongType" column="belong_type" />
<result property="images" column="images" />
<result property="brsStatus" column="brs_status" />
<result property="iotStatus" column="iot_status" />
<result property="iotCode" column="iot_code" />
<result property="operatorId" column="operator_id" />
<result property="operatorName" column="operator_name" />
<result property="storeId" column="store_id" />
<result property="storeName" column="store_name" />
<result property="packageId" column="package_id" />
<result property="packageName" column="package_name" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="extend1" column="extend1" />
<result property="extend2" column="extend2" />
<result property="extend3" column="extend3" />
<result property="extend4" column="extend4" />
<result property="extend5" column="extend5" />
</resultMap>
<sql id="selectZcCarVo">
select id, vin, license_plate, brand_id, brand_name, model_id, model_name, battery_type, weight, max_speed, lot_number, purchase_date, purchase_price, belong_type, images, brs_status, iot_status, iot_code, operator_id, operator_name, store_id, store_name, package_id, package_name, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3, extend4, extend5 from zc_car
</sql>
<select id="selectZcCarList" parameterType="ZcCar" resultMap="ZcCarResult">
<include refid="selectZcCarVo"/>
<where>
<if test="vin != null and vin != ''"> and vin = #{vin}</if>
<if test="licensePlate != null and licensePlate != ''"> and license_plate = #{licensePlate}</if>
<if test="brandId != null "> and brand_id = #{brandId}</if>
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
<if test="modelId != null "> and model_id = #{modelId}</if>
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
<if test="batteryType != null and batteryType != ''"> and battery_type = #{batteryType}</if>
<if test="weight != null and weight != ''"> and weight = #{weight}</if>
<if test="maxSpeed != null and maxSpeed != ''"> and max_speed = #{maxSpeed}</if>
<if test="lotNumber != null and lotNumber != ''"> and lot_number = #{lotNumber}</if>
<if test="purchaseDate != null "> and purchase_date = #{purchaseDate}</if>
<if test="purchasePrice != null "> and purchase_price = #{purchasePrice}</if>
<if test="belongType != null and belongType != ''"> and belong_type = #{belongType}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="brsStatus != null and brsStatus != ''"> and brs_status = #{brsStatus}</if>
<if test="iotStatus != null and iotStatus != ''"> and iot_status = #{iotStatus}</if>
<if test="iotCode != null and iotCode != ''"> and iot_code = #{iotCode}</if>
<if test="operatorId != null "> and operator_id = #{operatorId}</if>
<if test="operatorName != null and operatorName != ''"> and operator_name like concat('%', #{operatorName}, '%')</if>
<if test="storeId != null "> and store_id = #{storeId}</if>
<if test="storeName != null and storeName != ''"> and store_name like concat('%', #{storeName}, '%')</if>
<if test="packageId != null "> and package_id = #{packageId}</if>
<if test="packageName != null and packageName != ''"> and package_name like concat('%', #{packageName}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectZcCarById" parameterType="Long" resultMap="ZcCarResult">
<include refid="selectZcCarVo"/>
where id = #{id}
</select>
<select id="checkVinUnique" resultType="com.ruoyi.operation.domain.ZcCar">
SELECT * FROM zc_car WHERE vin = #{vin}
</select>
<insert id="insertZcCar" parameterType="ZcCar" useGeneratedKeys="true" keyProperty="id">
insert into zc_car
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="vin != null">vin,</if>
<if test="licensePlate != null">license_plate,</if>
<if test="brandId != null">brand_id,</if>
<if test="brandName != null">brand_name,</if>
<if test="modelId != null">model_id,</if>
<if test="modelName != null">model_name,</if>
<if test="batteryType != null">battery_type,</if>
<if test="weight != null">weight,</if>
<if test="maxSpeed != null">max_speed,</if>
<if test="lotNumber != null">lot_number,</if>
<if test="purchaseDate != null">purchase_date,</if>
<if test="purchasePrice != null">purchase_price,</if>
<if test="belongType != null">belong_type,</if>
<if test="images != null">images,</if>
<if test="brsStatus != null">brs_status,</if>
<if test="iotStatus != null">iot_status,</if>
<if test="iotCode != null">iot_code,</if>
<if test="operatorId != null">operator_id,</if>
<if test="operatorName != null">operator_name,</if>
<if test="storeId != null">store_id,</if>
<if test="storeName != null">store_name,</if>
<if test="packageId != null">package_id,</if>
<if test="packageName != null">package_name,</if>
<if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="extend1 != null">extend1,</if>
<if test="extend2 != null">extend2,</if>
<if test="extend3 != null">extend3,</if>
<if test="extend4 != null">extend4,</if>
<if test="extend5 != null">extend5,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="vin != null">#{vin},</if>
<if test="licensePlate != null">#{licensePlate},</if>
<if test="brandId != null">#{brandId},</if>
<if test="brandName != null">#{brandName},</if>
<if test="modelId != null">#{modelId},</if>
<if test="modelName != null">#{modelName},</if>
<if test="batteryType != null">#{batteryType},</if>
<if test="weight != null">#{weight},</if>
<if test="maxSpeed != null">#{maxSpeed},</if>
<if test="lotNumber != null">#{lotNumber},</if>
<if test="purchaseDate != null">#{purchaseDate},</if>
<if test="purchasePrice != null">#{purchasePrice},</if>
<if test="belongType != null">#{belongType},</if>
<if test="images != null">#{images},</if>
<if test="brsStatus != null">#{brsStatus},</if>
<if test="iotStatus != null">#{iotStatus},</if>
<if test="iotCode != null">#{iotCode},</if>
<if test="operatorId != null">#{operatorId},</if>
<if test="operatorName != null">#{operatorName},</if>
<if test="storeId != null">#{storeId},</if>
<if test="storeName != null">#{storeName},</if>
<if test="packageId != null">#{packageId},</if>
<if test="packageName != null">#{packageName},</if>
<if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="extend1 != null">#{extend1},</if>
<if test="extend2 != null">#{extend2},</if>
<if test="extend3 != null">#{extend3},</if>
<if test="extend4 != null">#{extend4},</if>
<if test="extend5 != null">#{extend5},</if>
</trim>
</insert>
<update id="updateZcCar" parameterType="ZcCar">
update zc_car
<trim prefix="SET" suffixOverrides=",">
<if test="vin != null">vin = #{vin},</if>
<if test="licensePlate != null">license_plate = #{licensePlate},</if>
<if test="brandId != null">brand_id = #{brandId},</if>
<if test="brandName != null">brand_name = #{brandName},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="modelName != null">model_name = #{modelName},</if>
<if test="batteryType != null">battery_type = #{batteryType},</if>
<if test="weight != null">weight = #{weight},</if>
<if test="maxSpeed != null">max_speed = #{maxSpeed},</if>
<if test="lotNumber != null">lot_number = #{lotNumber},</if>
<if test="purchaseDate != null">purchase_date = #{purchaseDate},</if>
<if test="purchasePrice != null">purchase_price = #{purchasePrice},</if>
<if test="belongType != null">belong_type = #{belongType},</if>
<if test="images != null">images = #{images},</if>
<if test="brsStatus != null">brs_status = #{brsStatus},</if>
<if test="iotStatus != null">iot_status = #{iotStatus},</if>
<if test="iotCode != null">iot_code = #{iotCode},</if>
<if test="operatorId != null">operator_id = #{operatorId},</if>
<if test="operatorName != null">operator_name = #{operatorName},</if>
<if test="storeId != null">store_id = #{storeId},</if>
<if test="storeName != null">store_name = #{storeName},</if>
<if test="packageId != null">package_id = #{packageId},</if>
<if test="packageName != null">package_name = #{packageName},</if>
<if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="extend1 != null">extend1 = #{extend1},</if>
<if test="extend2 != null">extend2 = #{extend2},</if>
<if test="extend3 != null">extend3 = #{extend3},</if>
<if test="extend4 != null">extend4 = #{extend4},</if>
<if test="extend5 != null">extend5 = #{extend5},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZcCarById" parameterType="Long">
delete from zc_car where id = #{id}
</delete>
<delete id="deleteZcCarByIds" parameterType="String">
delete from zc_car where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="batteryType" column="battery_type" /> <result property="batteryType" column="battery_type" />
<result property="maxSpeed" column="max_speed" /> <result property="maxSpeed" column="max_speed" />
<result property="weight" column="weight" /> <result property="weight" column="weight" />
<result property="image" column="image" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
@ -35,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectZcCarModelVo"> <sql id="selectZcCarModelVo">
select id, model_name, brand_id, brand_name, battery_type, max_speed, weight, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3 from zc_car_model select id, model_name, brand_id, brand_name, battery_type, max_speed, weight, image, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3 from zc_car_model
</sql> </sql>
<sql id="selectZcCarModelVo2"> <sql id="selectZcCarModelVo2">
select u.*, select u.*,
@ -67,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="batteryType != null">battery_type,</if> <if test="batteryType != null">battery_type,</if>
<if test="maxSpeed != null">max_speed,</if> <if test="maxSpeed != null">max_speed,</if>
<if test="weight != null">weight,</if> <if test="weight != null">weight,</if>
<if test="image != null">image,</if>
<if test="status != null">status,</if> <if test="status != null">status,</if>
<if test="delFlag != null">del_flag,</if> <if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if> <if test="createBy != null">create_by,</if>
@ -85,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="batteryType != null">#{batteryType},</if> <if test="batteryType != null">#{batteryType},</if>
<if test="maxSpeed != null">#{maxSpeed},</if> <if test="maxSpeed != null">#{maxSpeed},</if>
<if test="weight != null">#{weight},</if> <if test="weight != null">#{weight},</if>
<if test="image != null">#{image},</if>
<if test="status != null">#{status},</if> <if test="status != null">#{status},</if>
<if test="delFlag != null">#{delFlag},</if> <if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if> <if test="createBy != null">#{createBy},</if>
@ -107,6 +110,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="batteryType != null">battery_type = #{batteryType},</if> <if test="batteryType != null">battery_type = #{batteryType},</if>
<if test="maxSpeed != null">max_speed = #{maxSpeed},</if> <if test="maxSpeed != null">max_speed = #{maxSpeed},</if>
<if test="weight != null">weight = #{weight},</if> <if test="weight != null">weight = #{weight},</if>
<if test="image != null">image = #{image},</if>
<if test="status != null">status = #{status},</if> <if test="status != null">status = #{status},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if> <if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if> <if test="createBy != null">create_by = #{createBy},</if>
@ -132,4 +136,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach> </foreach>
</delete> </delete>
<select id="selectAllBrands" resultType="string">
SELECT DISTINCT brand_name FROM zc_car_model ORDER BY brand_name ASC
</select>
<select id="selectModelsByBrand" resultType="string">
SELECT model_name FROM zc_car_model WHERE brand_name = #{brandName} ORDER BY model_name ASC
</select>
</mapper> </mapper>

View File

@ -24,6 +24,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectZcCarModelPackageList" parameterType="ZcCarModelPackage" resultMap="ZcCarModelPackageResult"> <select id="selectZcCarModelPackageList" parameterType="ZcCarModelPackage" resultMap="ZcCarModelPackageResult">
<include refid="selectZcCarModelPackageVo"/> <include refid="selectZcCarModelPackageVo"/>
<where> <where>
<if test="id != null">id=#{id}</if>
<if test="carModelId != null">car_model_id = #{carModelId}</if>
<if test="carRuleId != null">car_rule_id = #{carRuleId}</if>
</where> </where>
</select> </select>

View File

@ -0,0 +1,239 @@
<!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-car-add">
<div class="form-group">
<label class="col-sm-3 control-label">车架号(VIN)</label>
<div class="col-sm-8">
<input name="vin" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">车牌号码:</label>
<div class="col-sm-8">
<input name="licensePlate" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">车辆品牌:</label>
<div class="col-sm-8">
<select name="brandName" id="brand-select" class="form-control m-b" required>
<option value="">请选择品牌</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">车辆型号:</label>
<div class="col-sm-8">
<select name="modelName" id="model-select" class="form-control m-b" required disabled>
<option value="">请先选择品牌</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">LOT识别号</label>
<div class="col-sm-8">
<input name="lotNumber" 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="input-group date">
<input name="purchaseDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">采购价格(元)</label>
<div class="col-sm-8">
<input name="purchasePrice" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">车辆归属:</label>
<div class="col-sm-8">
<select name="belongType" class="form-control m-b" th:with="type=${@dict.getType('key_car_belong_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IoT识别码</label>
<div class="col-sm-8">
<input name="iotCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">所属运营商:</label>
<div class="col-sm-8">
<input name="operatorName" id="operatorName" class="form-control" type="hidden" >
<select name="operatorId" id="operator-select" class="form-control m-b" required>
<option value="">请选择运营商</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属门店:</label>
<div class="col-sm-8">
<input name="storeName" id="storeName" class="form-control" type="hidden" >
<select name="storeId" id="store-select" class="form-control m-b" disabled>
<option value="">请先选择运营商</option>
</select>
</div>
</div>
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">应用套餐:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="packageId" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group"> -->
<!-- <label class="col-sm-3 control-label">应用套餐名称:</label>-->
<!-- <div class="col-sm-8">-->
<!-- <input name="packageName" class="form-control" type="text">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "operation/car"
$("#form-car-add").validate({
focusCleanup: true
});
$(function () {
// 加载品牌列表
$.ajax({
url: ctx + 'operation/carModel/brands',
type: 'GET',
success: function (brands) {
var brandSelect = $('#brand-select');
brands.forEach(function (brand) {
brandSelect.append('<option value="' + brand + '">' + brand + '</option>');
});
}
});
// 品牌选择变化时加载对应车型
$('#brand-select').on('change', function () {
var brandName = $(this).val();
var modelSelect = $('#model-select');
modelSelect.empty().append('<option value="">加载中...</option>').prop('disabled', true);
if (!brandName) {
modelSelect.empty().append('<option value="">请先选择品牌</option>').prop('disabled', true);
return;
}
$.ajax({
url: ctx + 'operation/carModel/getModels',
type: 'POST',
data: { brandName: brandName },
success: function (models) {
modelSelect.empty();
if (models.length === 0) {
modelSelect.append('<option value="">暂无车型</option>').prop('disabled', true);
} else {
models.forEach(function (model) {
modelSelect.append('<option value="' + model + '">' + model + '</option>');
});
modelSelect.prop('disabled', false);
}
}
});
});
// 加载运营商列表
$.ajax({
url: ctx + 'operation/company/companyAll',
type: 'GET',
success: function (companies) {
var operatorSelect = $('#operator-select');
companies.forEach(function (company) {
operatorSelect.append('<option value="' + company.id + '">' + company.companyName + '</option>');
});
}
});
// 运营商选择变化时加载对应门店
$('#operator-select').on('change', function () {
var companyId = $(this).val();
var operatorName = $('#operator-select option:selected').text(); // 获取 text 值(公司名称)
$("#operatorName").val(operatorName);
var storeSelect = $('#store-select');
storeSelect.empty().append('<option value="">加载中...</option>').prop('disabled', true);
if (!companyId) {
storeSelect.empty().append('<option value="">请先选择运营商</option>').prop('disabled', true);
return;
}
$.ajax({
url: ctx + 'operation/store/storesByCompanyId',
type: 'POST',
data: { companyId: companyId },
success: function (stores) {
storeSelect.empty();
if (stores.length === 0) {
storeSelect.append('<option value="">暂无门店</option>').prop('disabled', true);
} else {
stores.forEach(function (store) {
storeSelect.append('<option value="' + store.id + '">' + store.name + '</option>');
});
storeSelect.prop('disabled', false);
// 设置默认选中第一个门店,并赋值给 storeName
storeSelect.val(stores[0].id); // 默认选中第一个门店ID
$("#storeName").val(stores[0].name); // 将第一个门店名称赋值给 storeName
}
}
});
});
// 运营商选择变化时加载对应门店
$('#store-select').on('change', function () {
var storeId = $(this).val(); // 获取选中项的 value门店ID
var storeName = $('#store-select option:selected').text(); // 获取选中项的 text门店名称
// 将门店名称赋值给隐藏输入框
$("#storeName").val(storeName);
});
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-car-add').serialize());
}
}
$("input[name='purchaseDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -0,0 +1,167 @@
<!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>
<label>车架号:</label>
<input type="text" name="vin"/>
</li>
<li>
<label>车牌号码:</label>
<input type="text" name="licensePlate"/>
</li>
<li>
<label>车辆归属:</label>
<select name="belongType" th:with="type=${@dict.getType('key_car_belong_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>所属运营商名称:</label>
<input type="text" name="operatorName"/>
</li>
<li>
<label>所属门店名称:</label>
<input type="text" name="storeName"/>
</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="operation:car:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="operation:car:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="operation:car:remove">
<i class="fa fa-remove"></i> 删除
</a>
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="operation:car: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('operation:car:edit')}]];
var removeFlag = [[${@permission.hasPermi('operation:car:remove')}]];
var statusDatas = [[${@dict.getType('key_car_status')}]];
var batteryTypeDatas = [[${@dict.getType('key_car_battery_type')}]];
var belongTypeDatas = [[${@dict.getType('key_car_belong_type')}]];
var prefix = ctx + "operation/car";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "车型管理",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'vin',
title: '车架号(VIN)'
},
{
field: 'licensePlate',
title: '车牌号码'
},
{
field: 'brandName',
title: '车辆品牌'
},
{
field: 'modelName',
title: '车辆型号'
},
{
field: 'lotNumber',
title: 'LOT识别号'
},
{
field: 'purchaseDate',
title: '采购日期'
},
{
field: 'purchasePrice',
title: '采购价格(元)'
},
{
field: 'belongType',
title: '车辆归属',
formatter: function(value, row, index) {
return $.table.selectDictLabel(belongTypeDatas, value);
}
},
{
field: 'brsStatus',
title: 'BRS车辆状态'
},
{
field: 'iotStatus',
title: 'IoT设备状态'
},
{
field: 'iotCode',
title: 'IoT识别码'
},
{
field: 'operatorName',
title: '所属运营商'
},
{
field: 'storeName',
title: '所属门店'
},
{
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 + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -0,0 +1,279 @@
<!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-car-edit" th:object="${zcCar}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">车架号(VIN)</label>
<div class="col-sm-8">
<input name="vin" th:field="*{vin}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">车牌号码:</label>
<div class="col-sm-8">
<input name="licensePlate" th:field="*{licensePlate}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">车辆品牌:</label>
<div class="col-sm-8">
<select name="brandName" id="brand-select" class="form-control m-b" required>
<option value="">请选择品牌</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">车辆型号:</label>
<div class="col-sm-8">
<select name="modelName" id="model-select" class="form-control m-b" required disabled>
<option value="">请先选择品牌</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">LOT识别号</label>
<div class="col-sm-8">
<input name="lotNumber" th:field="*{lotNumber}" 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="input-group date">
<input name="purchaseDate" th:value="${#dates.format(zcCar.purchaseDate, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">采购价格(元)</label>
<div class="col-sm-8">
<input name="purchasePrice" th:field="*{purchasePrice}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">车辆归属:</label>
<div class="col-sm-8">
<select name="belongType" class="form-control m-b" th:with="type=${@dict.getType('key_car_belong_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{belongType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">IoT识别码</label>
<div class="col-sm-8">
<input name="iotCode" th:field="*{iotCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">所属运营商:</label>
<div class="col-sm-8">
<input name="operatorName" id="operatorName" class="form-control" type="hidden" >
<select name="operatorId" id="operator-select" class="form-control m-b" required>
<option value="">请选择运营商</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">所属门店:</label>
<div class="col-sm-8">
<input name="storeName" id="storeName" class="form-control" type="hidden" >
<select name="storeId" id="store-select" class="form-control m-b" disabled>
<option value="">请先选择运营商</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
<div class="col-sm-8">
<input name="remark" th:field="*{remark}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "operation/car";
$("#form-car-edit").validate({
focusCleanup: true
});
$(function () {
// 获取品牌与车型下拉框
var brandSelect = $('#brand-select');
var modelSelect = $('#model-select');
// 保存当前车辆的品牌与车型值
var savedBrand = [[${zcCar.brandName}]];
var savedModel = [[${zcCar.modelName}]];
// 加载品牌列表
$.ajax({
url: ctx + 'operation/carModel/brands',
type: 'GET',
success: function (brands) {
var brandSelect = $('#brand-select');
brands.forEach(function (brand) {
var option = $('<option>').val(brand).text(brand);
if (brand === savedBrand) {
option.attr('selected', 'selected');
}
brandSelect.append(option);
// var option = '<option value="' + brand + '">' + brand + '</option>';
// if (brand === [[${zcCar.brandName}]]) {
// option = '<option value="' + brand + '" selected>' + brand + '</option>';
// }
// brandSelect.append(option);
});
// 如果有已选品牌,则触发加载车型
if (savedBrand) {
modelSelect.prop('disabled', false).empty().append('<option value="">加载中...</option>');
loadModels(savedBrand, savedModel);
}
}
});
// =================== 品牌选择变化事件 ===================
brandSelect.on('change', function () {
var selectedBrand = $(this).val();
if (!selectedBrand) {
modelSelect.empty().append('<option value="">请先选择品牌</option>').prop('disabled', true);
return;
}
loadModels(selectedBrand);
});
// =================== 加载车型方法封装 ===================
function loadModels(brandName, savedModel = null) {
$.ajax({
url: ctx + 'operation/carModel/getModels',
type: 'POST',
data: { brandName: brandName },
success: function (models) {
modelSelect.empty();
if (models.length === 0) {
modelSelect.append('<option value="">暂无车型</option>').prop('disabled', true);
} else {
models.forEach(function (model) {
modelSelect.append($('<option>').val(model).text(model));
});
modelSelect.prop('disabled', false);
// 回显车型
if (savedModel) {
modelSelect.val(savedModel);
}
}
}
});
}
// 获取运营商与门店下拉框
var operatorSelect = $('#operator-select');
var storeSelect = $('#store-select');
// 保存当前车辆的运营商与门店值
var savedOperatorId = [[${zcCar.operatorId}]];
var savedStoreId = [[${zcCar.storeId}]];
// =================== 加载运营商列表 ===================
$.ajax({
url: ctx + 'operation/company/companyAll',
type: 'GET',
success: function (companies) {
companies.forEach(function (company) {
var option = $('<option>').val(company.id).text(company.companyName);
if (company.id == savedOperatorId) {
option.attr('selected', 'selected');
}
operatorSelect.append(option);
});
// 如果有已选运营商,则触发加载门店
if (savedOperatorId) {
storeSelect.prop('disabled', false).empty().append('<option value="">加载中...</option>');
loadStores(savedOperatorId, savedStoreId);
}
}
});
// =================== 运营商选择变化事件 ===================
operatorSelect.on('change', function () {
var selectedOperatorId = $(this).val();
if (!selectedOperatorId) {
storeSelect.empty().append('<option value="">请先选择运营商</option>').prop('disabled', true);
return;
}
// 设置隐藏域 operatorName
var selectedOperatorName = operatorSelect.find('option:selected').text();
$('#operatorName').val(selectedOperatorName);
loadStores(selectedOperatorId);
});
// =================== 加载门店方法封装 ===================
function loadStores(operatorId, savedStoreId = null) {
$.ajax({
url: ctx + 'operation/store/storesByCompanyId',
type: 'POST',
data: { companyId: operatorId },
success: function (stores) {
storeSelect.empty();
if (stores.length === 0) {
storeSelect.append('<option value="">暂无门店</option>').prop('disabled', true);
} else {
stores.forEach(function (store) {
storeSelect.append($('<option>').val(store.id).text(store.name));
});
storeSelect.prop('disabled', false);
// 回显门店
if (savedStoreId) {
storeSelect.val(savedStoreId);
// 设置隐藏域 storeName
var selectedStoreName = storeSelect.find('option:selected').text();
$('#storeName').val(selectedStoreName);
}
}
}
});
}
// =================== 门店选择变化事件 ===================
storeSelect.on('change', function () {
var selectedStoreId = $(this).val();
var selectedStoreName = $(this).find('option:selected').text();
$('#storeName').val(selectedStoreName);
});
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-car-edit').serialize());
}
}
$("input[name='purchaseDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

View File

@ -2,6 +2,10 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('新增车型管理')" /> <th:block th:include="include :: header('新增车型管理')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-fileinput-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -20,7 +24,35 @@
<input name="modelName" class="form-control" type="text" maxlength="20" required> <input name="modelName" class="form-control" type="text" maxlength="20" required>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">支持电池类型:</label>
<div class="col-sm-6">
<select name="batteryType" class="form-control m-b select2-multiple" multiple th:with="type=${@dict.getType('key_car_battery_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">整车重量(kg)</label>
<div class="col-sm-6">
<input name="weight" class="form-control" type="text" maxlength="10" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">最高时速(km/h)</label>
<div class="col-sm-6">
<input name="maxSpeed" class="form-control" type="text" maxlength="10" >
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">车型图片:</label>
<div class="col-sm-6">
<input type="hidden" name="image">
<div class="file-loading">
<input class="form-control file-upload" id="image" name="file" type="file">
</div>
</div>
</div>
<h4 class="form-header h4">关联套餐</h4> <h4 class="form-header h4">关联套餐</h4>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
@ -32,6 +64,10 @@
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "operation/carModel" var prefix = ctx + "operation/carModel"
var rentCarRuleList = [[${rentCarRuleList}]] var rentCarRuleList = [[${rentCarRuleList}]]
@ -43,6 +79,44 @@
focusCleanup: true focusCleanup: true
}); });
$(document).ready(function () {
// 单图上传
$("#image").fileinput({
uploadUrl: ctx + 'common/newUpload',
uploadExtraData: {
dataType: '30'
},
maxFileCount: 1,
autoReplace: true,
showClose: false,
layoutTemplates: {
actionDelete: '', //去除上传预览的缩略图中的删除图标
actionUpload: '',//去除上传预览缩略图中的上传图片图标;
actionZoom: '' //去除上传预览缩略图中的查看详情预览的缩略图标。
},
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
preId = previewId;
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
}).on("filebatchselected", function (event, files) {
if (preId !== '') {
document.getElementById(preId).remove()
}
$("#image").fileinput("upload");
}).on('fileerror', function (event, data, msg) {
$("input[name='" + event.currentTarget.id + "']").val('')
// 清除当前的预览图 ,并隐藏 【移除】 按钮
$(event.target).fileinput('clear').fileinput('unlock')
$(event.target).parent().siblings('.fileinput-remove').hide()
// 打开失败的信息弹窗
$.modal.alertError('上传失败,请稍后重试')
}
).on("filecleared", function (event, data, msg) {
$("input[name='" + event.currentTarget.id + "']").val('')
});
});
$(function() { $(function() {
var options = { var options = {
data: rentCarRuleList, data: rentCarRuleList,

View File

@ -56,6 +56,7 @@
var editFlag = [[${@permission.hasPermi('operation:carModel:edit')}]]; var editFlag = [[${@permission.hasPermi('operation:carModel:edit')}]];
var removeFlag = [[${@permission.hasPermi('operation:carModel:remove')}]]; var removeFlag = [[${@permission.hasPermi('operation:carModel:remove')}]];
var statusDatas = [[${@dict.getType('key_company_status')}]]; var statusDatas = [[${@dict.getType('key_company_status')}]];
var batteryTypeDatas = [[${@dict.getType('key_car_battery_type')}]];
var prefix = ctx + "operation/carModel"; var prefix = ctx + "operation/carModel";
$(function() { $(function() {
@ -85,6 +86,21 @@
title: '车型名称', title: '车型名称',
width: '400' width: '400'
}, },
{
field: 'batteryType',
title: '支持电池类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(batteryTypeDatas, value);
}
},
{
field: 'weight',
title: '整车重量(kg)'
},
{
field: 'maxSpeed',
title: '最高时速(km/h)'
},
{ {
field: 'status', field: 'status',
title: '状态', title: '状态',

View File

@ -2,6 +2,10 @@
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head> <head>
<th:block th:include="include :: header('修改车型管理')" /> <th:block th:include="include :: header('修改车型管理')" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: bootstrap-fileinput-css" />
<th:block th:include="include :: select2-css" />
<th:block th:include="include :: bootstrap-select-css" />
</head> </head>
<body class="white-bg"> <body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> <div class="wrapper wrapper-content animated fadeInRight ibox-content">
@ -20,7 +24,35 @@
<input name="modelName" th:field="*{modelName}" class="form-control" type="text" required> <input name="modelName" th:field="*{modelName}" class="form-control" type="text" required>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">支持电池类型:</label>
<div class="col-sm-6">
<select name="batteryType" class="form-control m-b select2-multiple" multiple th:with="type=${@dict.getType('key_car_battery_type')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{batteryType}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">整车重量(kg)</label>
<div class="col-sm-6">
<input name="weight" th:field="*{weight}" class="form-control" type="text" maxlength="10">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">最高时速(km/h)</label>
<div class="col-sm-6">
<input name="maxSpeed" th:field="*{maxSpeed}" class="form-control" type="text" maxlength="10">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">车型图片:</label>
<div class="col-sm-6">
<input type="hidden" name="image" th:value="*{image}">
<div class="file-loading">
<input class="form-control file-upload" id="image" name="file" type="file">
</div>
</div>
</div>
<h4 class="form-header h4">关联套餐</h4> <h4 class="form-header h4">关联套餐</h4>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
@ -32,6 +64,10 @@
</form> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<th:block th:include="include :: bootstrap-fileinput-js" />
<th:block th:include="include :: select2-js" />
<th:block th:include="include :: bootstrap-select-js" />
<script th:inline="javascript"> <script th:inline="javascript">
var prefix = ctx + "operation/carModel"; var prefix = ctx + "operation/carModel";
var rentCarRuleList = [[${rentCarRuleList}]] var rentCarRuleList = [[${rentCarRuleList}]]
@ -44,6 +80,14 @@
}); });
$(function() { $(function() {
// 初始化 select2
$('.select2-multiple').select2();
// 设置默认选中值(假设 batteryType 是一个逗号分隔的字符串)
var selectedValues = [[${zcCarModel.batteryType}]].split(',');
$('.select2-multiple').val(selectedValues).trigger('change');
var options = { var options = {
data: rentCarRuleList, data: rentCarRuleList,
sidePagination: "client", sidePagination: "client",
@ -143,6 +187,48 @@
$.operate.save(prefix + "/edit", $('#form-carModel-edit').serialize()); $.operate.save(prefix + "/edit", $('#form-carModel-edit').serialize());
} }
} }
let preId = '';
let initUrl = new Array();
initUrl.push([[${zcCarModel.image}]]);
$("#image").fileinput({
uploadUrl: ctx + 'common/newUpload',
uploadExtraData: {
dataType: '30'
},
maxFileCount: 1,
autoReplace: true,
showClose: false,
initialPreview: initUrl,
initialPreviewFileType: 'image',
initialPreviewAsData: true,
layoutTemplates :{
actionDelete:'', //去除上传预览的缩略图中的删除图标
actionUpload:'',//去除上传预览缩略图中的上传图片图标;
// actionZoom:'' //去除上传预览缩略图中的查看详情预览的缩略图标。
},
}).on('fileuploaded', function (event, data, previewId, index) {
$("input[name='" + event.currentTarget.id + "']").val(data.response.url)
preId = previewId;
}).on('fileremoved', function (event, id, index) {
$("input[name='" + event.currentTarget.id + "']").val('')
}).on("filebatchselected", function(event, files) {
if(preId !== ''){
document.getElementById(preId).remove()
}
$("#image").fileinput("upload");
}).on('fileerror', function (event,data,msg){
$("input[name='" + event.currentTarget.id + "']").val('')
// 清除当前的预览图 ,并隐藏 【移除】 按钮
$(event.target).fileinput('clear').fileinput('unlock')
$(event.target).parent().siblings('.fileinput-remove').hide()
// 打开失败的信息弹窗
$.modal.alertError('上传失败,请稍后重试')
}
).on("filecleared",function(event, data, msg){
$("input[name='" + event.currentTarget.id + "']").val('')
});
</script> </script>
</body> </body>
</html> </html>