增加品牌管理,品牌动态选择
This commit is contained in:
@ -113,6 +113,10 @@ public class CompanyStoreController extends BaseController
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(CompanyStore companyStore)
|
||||
{
|
||||
if (CompanyStore.NOT_UNIQUE.equals(companyStoreService.checkStoreNoUnique(companyStore)))
|
||||
{
|
||||
return error("新增失败,门店编号'" + companyStore.getStoreNumber() + "'已存在");
|
||||
}
|
||||
companyStore.setCreateBy(getLoginName());
|
||||
return toAjax(companyStoreService.insertCompanyStore(companyStore));
|
||||
}
|
||||
@ -142,6 +146,11 @@ public class CompanyStoreController extends BaseController
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(CompanyStore companyStore)
|
||||
{
|
||||
// 验证门店编号是否存在(排除当前正在编辑的门店)
|
||||
if (CompanyStore.NOT_UNIQUE.equals(companyStoreService.checkStoreNoUnique(companyStore)))
|
||||
{
|
||||
return error("修改失败,门店编号'" + companyStore.getStoreNumber() + "'已存在");
|
||||
}
|
||||
companyStore.setUpdateBy(getLoginName());
|
||||
return toAjax(companyStoreService.updateCompanyStore(companyStore));
|
||||
}
|
||||
|
||||
@ -0,0 +1,142 @@
|
||||
package com.ruoyi.operation.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.operation.domain.ZcCarModel;
|
||||
import com.ruoyi.operation.service.IZcCarModelService;
|
||||
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.ZcCarBrand;
|
||||
import com.ruoyi.operation.service.IZcCarBrandService;
|
||||
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-08-11
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/operation/carBrand")
|
||||
public class ZcCarBrandController extends BaseController
|
||||
{
|
||||
private String prefix = "operation/carBrand";
|
||||
|
||||
@Autowired
|
||||
private IZcCarBrandService zcCarBrandService;
|
||||
@Autowired
|
||||
private IZcCarModelService zcCarModelService;
|
||||
@RequiresPermissions("operation:carBrand:view")
|
||||
@GetMapping()
|
||||
public String carBrand()
|
||||
{
|
||||
return prefix + "/carBrand";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询品牌管理列表
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
startPage();
|
||||
List<ZcCarBrand> list = zcCarBrandService.selectZcCarBrandList(zcCarBrand);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出品牌管理列表
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:export")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
List<ZcCarBrand> list = zcCarBrandService.selectZcCarBrandList(zcCarBrand);
|
||||
ExcelUtil<ZcCarBrand> util = new ExcelUtil<ZcCarBrand>(ZcCarBrand.class);
|
||||
return util.exportExcel(list, "品牌管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存品牌管理
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:add")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
return toAjax(zcCarBrandService.insertZcCarBrand(zcCarBrand));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:edit")
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
{
|
||||
ZcCarBrand zcCarBrand = zcCarBrandService.selectZcCarBrandById(id);
|
||||
mmap.put("zcCarBrand", zcCarBrand);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存品牌管理
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:edit")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
return toAjax(zcCarBrandService.updateZcCarBrand(zcCarBrand));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除品牌管理
|
||||
*/
|
||||
@RequiresPermissions("operation:carBrand:remove")
|
||||
@Log(title = "品牌管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
List<ZcCarModel> brandList = zcCarModelService.selectModelsByBrand(ids);
|
||||
if(brandList.size() > 0){
|
||||
return error("请先删除该品牌下的车型");
|
||||
}
|
||||
return toAjax(zcCarBrandService.deleteZcCarBrandByIds(ids));
|
||||
}
|
||||
|
||||
@GetMapping("/brands")
|
||||
@ResponseBody
|
||||
public List<ZcCarBrand> getBrands() {
|
||||
return zcCarBrandService.selectZcCarBrandList(new ZcCarBrand());
|
||||
}
|
||||
|
||||
}
|
||||
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.operation.domain.*;
|
||||
import com.ruoyi.operation.service.IZcCarBrandService;
|
||||
import com.ruoyi.operation.service.IZcCarModelPackageService;
|
||||
import com.ruoyi.operation.service.IZcRentCarRuleService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
@ -38,11 +40,14 @@ public class ZcCarModelController extends BaseController
|
||||
private IZcRentCarRuleService zcRentCarRuleService;
|
||||
@Autowired
|
||||
private IZcCarModelPackageService zcCarModelPackageService;
|
||||
|
||||
@Autowired
|
||||
private IZcCarBrandService zcCarBrandService;
|
||||
@RequiresPermissions("operation:carModel:view")
|
||||
@GetMapping()
|
||||
public String carModel()
|
||||
public String carModel(ModelMap mmap)
|
||||
{
|
||||
List<ZcCarBrand> carBrandList = zcCarBrandService.selectZcCarBrandList(new ZcCarBrand());
|
||||
mmap.put("carBrandList", carBrandList);
|
||||
return prefix + "/carModel";
|
||||
}
|
||||
|
||||
@ -79,6 +84,8 @@ public class ZcCarModelController extends BaseController
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
List<ZcCarBrand> carBrandList = zcCarBrandService.selectZcCarBrandList(new ZcCarBrand());
|
||||
mmap.put("carBrandList", carBrandList);
|
||||
ZcRentCarRule zcRentCarRule = new ZcRentCarRule();
|
||||
zcRentCarRule.setStatus("0");
|
||||
List<ZcRentCarRule> rentCarRuleList = zcRentCarRuleService.selectZcRentCarRuleList(zcRentCarRule);
|
||||
@ -96,6 +103,11 @@ public class ZcCarModelController extends BaseController
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(@RequestParam("rentCarRuleIds") List<Long> rentCarRuleIds, ZcCarModel zcCarModel)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(zcCarModel.getModelName())
|
||||
&& ZcCarModel.NOT_UNIQUE.equals(zcCarModelService.checkModelNameUnique(zcCarModel)))
|
||||
{
|
||||
return error("新增失败,该车型已存在");
|
||||
}
|
||||
zcCarModel.setCreateBy(getLoginName());
|
||||
return toAjax(zcCarModelService.insertZcCarModel(rentCarRuleIds, zcCarModel));
|
||||
}
|
||||
@ -107,6 +119,8 @@ public class ZcCarModelController extends BaseController
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
{
|
||||
List<ZcCarBrand> carBrandList = zcCarBrandService.selectZcCarBrandList(new ZcCarBrand());
|
||||
mmap.put("carBrandList", carBrandList);
|
||||
|
||||
List<ZcRentCarRule> rentCarRuleList = zcRentCarRuleService.selectZcRentCarRuleListByCarModelId(id);
|
||||
mmap.put("rentCarRuleList", rentCarRuleList);
|
||||
@ -124,6 +138,11 @@ public class ZcCarModelController extends BaseController
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(@RequestParam("rentCarRuleIds") List<Long> rentCarRuleIds, ZcCarModel zcCarModel)
|
||||
{
|
||||
if (StringUtils.isNotEmpty(zcCarModel.getModelName())
|
||||
&& ZcCarModel.NOT_UNIQUE.equals(zcCarModelService.checkModelNameUnique(zcCarModel)))
|
||||
{
|
||||
return error("修改失败,该车型已存在");
|
||||
}
|
||||
zcCarModel.setUpdateBy(getLoginName());
|
||||
return toAjax(zcCarModelService.updateZcCarModel(rentCarRuleIds,zcCarModel));
|
||||
}
|
||||
@ -159,8 +178,8 @@ public class ZcCarModelController extends BaseController
|
||||
|
||||
@PostMapping("/getModels")
|
||||
@ResponseBody
|
||||
public List<ZcCarModel> getModels(String brandName) {
|
||||
return zcCarModelService.selectModelsByBrand(brandName);
|
||||
public List<ZcCarModel> getModels(String brandId) {
|
||||
return zcCarModelService.selectModelsByBrand(brandId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -191,6 +191,11 @@ public class CompanyStore extends BaseEntity
|
||||
@Transient
|
||||
private String operatingCompanyName;
|
||||
|
||||
|
||||
public final static String UNIQUE = "0";
|
||||
public final static String NOT_UNIQUE = "1";
|
||||
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
@ -0,0 +1,154 @@
|
||||
package com.ruoyi.operation.domain;
|
||||
|
||||
import java.util.List;
|
||||
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_brand
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public class ZcCarBrand extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 车型ID */
|
||||
private Long id;
|
||||
|
||||
/** 品牌名称 */
|
||||
@Excel(name = "品牌名称")
|
||||
private String brandName;
|
||||
|
||||
/** 品牌介绍 */
|
||||
@Excel(name = "品牌介绍")
|
||||
private String brandIntro;
|
||||
|
||||
/** 状态(0正常 1停用) */
|
||||
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0存在 2删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 扩展字段1 */
|
||||
@Excel(name = "扩展字段1")
|
||||
private String extend1;
|
||||
|
||||
/** 扩展字段2 */
|
||||
@Excel(name = "扩展字段2")
|
||||
private String extend2;
|
||||
|
||||
/** 扩展字段3 */
|
||||
@Excel(name = "扩展字段3")
|
||||
private String extend3;
|
||||
|
||||
/** 车型管理信息 */
|
||||
private List<ZcCarModel> zcCarModelList;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setBrandName(String brandName)
|
||||
{
|
||||
this.brandName = brandName;
|
||||
}
|
||||
|
||||
public String getBrandName()
|
||||
{
|
||||
return brandName;
|
||||
}
|
||||
public void setBrandIntro(String brandIntro)
|
||||
{
|
||||
this.brandIntro = brandIntro;
|
||||
}
|
||||
|
||||
public String getBrandIntro()
|
||||
{
|
||||
return brandIntro;
|
||||
}
|
||||
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 List<ZcCarModel> getZcCarModelList()
|
||||
{
|
||||
return zcCarModelList;
|
||||
}
|
||||
|
||||
public void setZcCarModelList(List<ZcCarModel> zcCarModelList)
|
||||
{
|
||||
this.zcCarModelList = zcCarModelList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("brandName", getBrandName())
|
||||
.append("brandIntro", getBrandIntro())
|
||||
.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("zcCarModelList", getZcCarModelList())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -67,6 +67,11 @@ public class ZcCarModel extends BaseEntity
|
||||
@Transient
|
||||
private boolean flag = false;
|
||||
|
||||
|
||||
public final static String UNIQUE = "0";
|
||||
public final static String NOT_UNIQUE = "1";
|
||||
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
||||
@ -19,6 +19,14 @@ public interface CompanyStoreMapper
|
||||
*/
|
||||
public CompanyStore selectCompanyStoreById(Long id);
|
||||
|
||||
/**
|
||||
* 检查门店编号是否唯一
|
||||
*
|
||||
* @param storeNo 门店编号
|
||||
* @return 门店信息
|
||||
*/
|
||||
public CompanyStore checkStoreNoUnique(String storeNo);
|
||||
|
||||
/**
|
||||
* 查询门店列表
|
||||
*
|
||||
|
||||
@ -0,0 +1,87 @@
|
||||
package com.ruoyi.operation.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.operation.domain.ZcCarBrand;
|
||||
import com.ruoyi.operation.domain.ZcCarModel;
|
||||
|
||||
/**
|
||||
* 品牌管理Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface ZcCarBrandMapper
|
||||
{
|
||||
/**
|
||||
* 查询品牌管理
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 品牌管理
|
||||
*/
|
||||
public ZcCarBrand selectZcCarBrandById(Long id);
|
||||
|
||||
/**
|
||||
* 查询品牌管理列表
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 品牌管理集合
|
||||
*/
|
||||
public List<ZcCarBrand> selectZcCarBrandList(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertZcCarBrand(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateZcCarBrand(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 删除品牌管理
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarBrandById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除品牌管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarBrandByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量删除车型管理
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarModelByBrandIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 批量新增车型管理
|
||||
*
|
||||
* @param zcCarModelList 车型管理列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchZcCarModel(List<ZcCarModel> zcCarModelList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过品牌管理主键删除车型管理信息
|
||||
*
|
||||
* @param id 品牌管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarModelByBrandId(Long id);
|
||||
}
|
||||
@ -51,6 +51,7 @@ public interface ZcCarModelMapper
|
||||
*/
|
||||
public int deleteZcCarModelById(Long id);
|
||||
|
||||
public int updateZcCarModelBrand(ZcCarModel zcCarModel);
|
||||
/**
|
||||
* 批量删除车型管理
|
||||
*
|
||||
@ -61,6 +62,8 @@ public interface ZcCarModelMapper
|
||||
|
||||
public List<String> selectAllBrands();
|
||||
|
||||
public List<ZcCarModel> selectModelsByBrand(String brandName);
|
||||
public List<ZcCarModel> selectModelsByBrand(String brandId);
|
||||
|
||||
ZcCarModel checkModelNameUnique(ZcCarModel zcCarModel);
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,13 @@ public interface ICompanyStoreService
|
||||
*/
|
||||
public List<CompanyStore> selectCompanyStoreList(CompanyStore companyStore);
|
||||
|
||||
/**
|
||||
* 检查门店编号是否唯一
|
||||
* @param companyStore 门店信息
|
||||
* @return 结果码
|
||||
*/
|
||||
public String checkStoreNoUnique(CompanyStore companyStore);
|
||||
|
||||
/**
|
||||
* 新增门店
|
||||
*
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.operation.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.operation.domain.ZcCarBrand;
|
||||
|
||||
/**
|
||||
* 品牌管理Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public interface IZcCarBrandService
|
||||
{
|
||||
/**
|
||||
* 查询品牌管理
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 品牌管理
|
||||
*/
|
||||
public ZcCarBrand selectZcCarBrandById(Long id);
|
||||
|
||||
/**
|
||||
* 查询品牌管理列表
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 品牌管理集合
|
||||
*/
|
||||
public List<ZcCarBrand> selectZcCarBrandList(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertZcCarBrand(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateZcCarBrand(ZcCarBrand zcCarBrand);
|
||||
|
||||
/**
|
||||
* 批量删除品牌管理
|
||||
*
|
||||
* @param ids 需要删除的品牌管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarBrandByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除品牌管理信息
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteZcCarBrandById(Long id);
|
||||
}
|
||||
@ -19,6 +19,7 @@ public interface IZcCarModelService
|
||||
*/
|
||||
public ZcCarModel selectZcCarModelById(Long id);
|
||||
|
||||
public String checkModelNameUnique(ZcCarModel zcCarModel);
|
||||
/**
|
||||
* 查询车型管理列表
|
||||
*
|
||||
@ -46,6 +47,7 @@ public interface IZcCarModelService
|
||||
|
||||
public int updateZcCarModel(List<Long> rentCarRuleIds, ZcCarModel zcCarModel);
|
||||
|
||||
public int updateZcCarModelBrand(ZcCarModel zcCarModel);
|
||||
/**
|
||||
* 批量删除车型管理
|
||||
*
|
||||
@ -73,6 +75,6 @@ public interface IZcCarModelService
|
||||
/**
|
||||
* 根据品牌查询车型列表
|
||||
*/
|
||||
List<ZcCarModel> selectModelsByBrand(String brandName);
|
||||
List<ZcCarModel> selectModelsByBrand(String brandId);
|
||||
|
||||
}
|
||||
|
||||
@ -49,6 +49,24 @@ public class CompanyStoreServiceImpl implements ICompanyStoreService
|
||||
return companyStoreMapper.selectCompanyStoreList(companyStore);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查门店编号是否唯一
|
||||
*
|
||||
* @param companyStore 门店信息
|
||||
* @return 结果码
|
||||
*/
|
||||
@Override
|
||||
public String checkStoreNoUnique(CompanyStore companyStore)
|
||||
{
|
||||
Long storeId = StringUtils.isNull(companyStore.getId()) ? -1L : companyStore.getId();
|
||||
CompanyStore info = companyStoreMapper.checkStoreNoUnique(companyStore.getStoreNumber());
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != storeId.longValue())
|
||||
{
|
||||
return CompanyStore.NOT_UNIQUE;
|
||||
}
|
||||
return CompanyStore.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增门店
|
||||
*
|
||||
|
||||
@ -0,0 +1,144 @@
|
||||
package com.ruoyi.operation.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.operation.service.IZcCarModelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.operation.domain.ZcCarModel;
|
||||
import com.ruoyi.operation.mapper.ZcCarBrandMapper;
|
||||
import com.ruoyi.operation.domain.ZcCarBrand;
|
||||
import com.ruoyi.operation.service.IZcCarBrandService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 品牌管理Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
@Service
|
||||
public class ZcCarBrandServiceImpl implements IZcCarBrandService
|
||||
{
|
||||
@Autowired
|
||||
private ZcCarBrandMapper zcCarBrandMapper;
|
||||
@Autowired
|
||||
private IZcCarModelService zcCarModelService;
|
||||
/**
|
||||
* 查询品牌管理
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 品牌管理
|
||||
*/
|
||||
@Override
|
||||
public ZcCarBrand selectZcCarBrandById(Long id)
|
||||
{
|
||||
return zcCarBrandMapper.selectZcCarBrandById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询品牌管理列表
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 品牌管理
|
||||
*/
|
||||
@Override
|
||||
public List<ZcCarBrand> selectZcCarBrandList(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
return zcCarBrandMapper.selectZcCarBrandList(zcCarBrand);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int insertZcCarBrand(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
zcCarBrand.setCreateTime(DateUtils.getNowDate());
|
||||
int rows = zcCarBrandMapper.insertZcCarBrand(zcCarBrand);
|
||||
//insertZcCarModel(zcCarBrand);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改品牌管理
|
||||
*
|
||||
* @param zcCarBrand 品牌管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateZcCarBrand(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
zcCarBrand.setUpdateTime(DateUtils.getNowDate());
|
||||
//zcCarBrandMapper.deleteZcCarModelByBrandId(zcCarBrand.getId());
|
||||
//insertZcCarModel(zcCarBrand);
|
||||
int flag = zcCarBrandMapper.updateZcCarBrand(zcCarBrand);
|
||||
if(flag > 0) {
|
||||
ZcCarModel zcCarModel = new ZcCarModel();
|
||||
zcCarModel.setBrandId(zcCarBrand.getId());
|
||||
zcCarModel.setBrandName(zcCarBrand.getBrandName());
|
||||
zcCarModelService.updateZcCarModelBrand(zcCarModel);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除品牌管理
|
||||
*
|
||||
* @param ids 需要删除的品牌管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteZcCarBrandByIds(String ids)
|
||||
{
|
||||
zcCarBrandMapper.deleteZcCarModelByBrandIds(Convert.toStrArray(ids));
|
||||
return zcCarBrandMapper.deleteZcCarBrandByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除品牌管理信息
|
||||
*
|
||||
* @param id 品牌管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int deleteZcCarBrandById(Long id)
|
||||
{
|
||||
zcCarBrandMapper.deleteZcCarModelByBrandId(id);
|
||||
return zcCarBrandMapper.deleteZcCarBrandById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增车型管理信息
|
||||
*
|
||||
* @param zcCarBrand 品牌管理对象
|
||||
*/
|
||||
public void insertZcCarModel(ZcCarBrand zcCarBrand)
|
||||
{
|
||||
List<ZcCarModel> zcCarModelList = zcCarBrand.getZcCarModelList();
|
||||
Long id = zcCarBrand.getId();
|
||||
if (StringUtils.isNotNull(zcCarModelList))
|
||||
{
|
||||
List<ZcCarModel> list = new ArrayList<ZcCarModel>();
|
||||
for (ZcCarModel zcCarModel : zcCarModelList)
|
||||
{
|
||||
zcCarModel.setBrandId(id);
|
||||
list.add(zcCarModel);
|
||||
}
|
||||
if (list.size() > 0)
|
||||
{
|
||||
zcCarBrandMapper.batchZcCarModel(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.operation.domain.ZcCarModelPackage;
|
||||
import com.ruoyi.operation.service.IZcCarModelPackageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -40,6 +42,17 @@ public class ZcCarModelServiceImpl implements IZcCarModelService
|
||||
return zcCarModelMapper.selectZcCarModelById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String checkModelNameUnique(ZcCarModel zcCarModel) {
|
||||
Long modelId = StringUtils.isNull(zcCarModel.getId()) ? -1L : zcCarModel.getId();
|
||||
ZcCarModel info = zcCarModelMapper.checkModelNameUnique(zcCarModel);
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != modelId.longValue())
|
||||
{
|
||||
return ZcCarModel.NOT_UNIQUE;
|
||||
}
|
||||
return ZcCarModel.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车型管理列表
|
||||
*
|
||||
@ -142,13 +155,25 @@ public class ZcCarModelServiceImpl implements IZcCarModelService
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新车辆品牌型号信息
|
||||
*
|
||||
* @param zcCarModel 车辆品牌型号对象,包含要更新的品牌型号信息
|
||||
* @return 更新操作影响的记录数
|
||||
*/
|
||||
@Override
|
||||
public int updateZcCarModelBrand(ZcCarModel zcCarModel){
|
||||
return zcCarModelMapper.updateZcCarModelBrand(zcCarModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除车型管理
|
||||
*
|
||||
* @param ids 需要删除的车型管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
|
||||
|
||||
public int deleteZcCarModelByIds(String ids)
|
||||
{
|
||||
return zcCarModelMapper.deleteZcCarModelByIds(Convert.toStrArray(ids));
|
||||
@ -179,8 +204,8 @@ public class ZcCarModelServiceImpl implements IZcCarModelService
|
||||
|
||||
|
||||
@Override
|
||||
public List<ZcCarModel> selectModelsByBrand(String brandName) {
|
||||
return zcCarModelMapper.selectModelsByBrand(brandName);
|
||||
public List<ZcCarModel> selectModelsByBrand(String brandId) {
|
||||
return zcCarModelMapper.selectModelsByBrand(brandId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ public class ZcCarServiceImpl implements IZcCarService
|
||||
{
|
||||
try
|
||||
{
|
||||
// 验证是否存在这个用户
|
||||
// 验证是否存在
|
||||
ZcCar u = zcCarMapper.checkVinUnique(car.getVin());
|
||||
if (StringUtils.isNull(u))
|
||||
{
|
||||
|
||||
@ -120,6 +120,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="checkStoreNoUnique" parameterType="String" resultMap="CompanyStoreResult">
|
||||
<include refid="selectCompanyStoreVo"/>
|
||||
where store_number = #{storeNumber} and del_flag = '0' limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertCompanyStore" parameterType="CompanyStore" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into zc_company_store
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
@ -0,0 +1,151 @@
|
||||
<?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.ZcCarBrandMapper">
|
||||
|
||||
<resultMap type="ZcCarBrand" id="ZcCarBrandResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="brandName" column="brand_name" />
|
||||
<result property="brandIntro" column="brand_intro" />
|
||||
<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" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ZcCarBrandZcCarModelResult" type="ZcCarBrand" extends="ZcCarBrandResult">
|
||||
<collection property="zcCarModelList" notNullColumn="sub_id" javaType="java.util.List" resultMap="ZcCarModelResult" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="ZcCarModel" id="ZcCarModelResult">
|
||||
<result property="id" column="sub_id" />
|
||||
<result property="modelName" column="sub_model_name" />
|
||||
<result property="brandId" column="sub_brand_id" />
|
||||
<result property="brandName" column="sub_brand_name" />
|
||||
<result property="batteryType" column="sub_battery_type" />
|
||||
<result property="maxSpeed" column="sub_max_speed" />
|
||||
<result property="weight" column="sub_weight" />
|
||||
<result property="status" column="sub_status" />
|
||||
<result property="delFlag" column="sub_del_flag" />
|
||||
<result property="createBy" column="sub_create_by" />
|
||||
<result property="createTime" column="sub_create_time" />
|
||||
<result property="updateBy" column="sub_update_by" />
|
||||
<result property="updateTime" column="sub_update_time" />
|
||||
<result property="remark" column="sub_remark" />
|
||||
<result property="extend1" column="sub_extend1" />
|
||||
<result property="extend2" column="sub_extend2" />
|
||||
<result property="extend3" column="sub_extend3" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectZcCarBrandVo">
|
||||
select id, brand_name, brand_intro, status, del_flag, create_by, create_time, update_by, update_time, remark, extend1, extend2, extend3 from zc_car_brand
|
||||
</sql>
|
||||
|
||||
<select id="selectZcCarBrandList" parameterType="ZcCarBrand" resultMap="ZcCarBrandResult">
|
||||
<include refid="selectZcCarBrandVo"/>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="brandName != null and brandName != ''"> and brand_name like concat('%', #{brandName}, '%')</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="extend1 != null and extend1 != ''"> and extend1 = #{extend1}</if>
|
||||
<if test="extend2 != null and extend2 != ''"> and extend2 = #{extend2}</if>
|
||||
<if test="extend3 != null and extend3 != ''"> and extend3 = #{extend3}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectZcCarBrandById" parameterType="Long" resultMap="ZcCarBrandZcCarModelResult">
|
||||
select a.id, a.brand_name, a.brand_intro, a.status, a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, a.extend1, a.extend2, a.extend3,
|
||||
b.id as sub_id, b.model_name as sub_model_name, b.brand_id as sub_brand_id, b.brand_name as sub_brand_name, b.battery_type as sub_battery_type, b.max_speed as sub_max_speed, b.weight as sub_weight, b.status as sub_status, b.del_flag as sub_del_flag, b.create_by as sub_create_by, b.create_time as sub_create_time, b.update_by as sub_update_by, b.update_time as sub_update_time, b.remark as sub_remark, b.extend1 as sub_extend1, b.extend2 as sub_extend2, b.extend3 as sub_extend3
|
||||
from zc_car_brand a
|
||||
left join zc_car_model b on b.brand_id = a.id
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertZcCarBrand" parameterType="ZcCarBrand" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into zc_car_brand
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="brandName != null and brandName != ''">brand_name,</if>
|
||||
<if test="brandIntro != null">brand_intro,</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>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="brandName != null and brandName != ''">#{brandName},</if>
|
||||
<if test="brandIntro != null">#{brandIntro},</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>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateZcCarBrand" parameterType="ZcCarBrand">
|
||||
update zc_car_brand
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="brandName != null and brandName != ''">brand_name = #{brandName},</if>
|
||||
<if test="brandIntro != null">brand_intro = #{brandIntro},</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>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteZcCarBrandById" parameterType="Long">
|
||||
delete from zc_car_brand where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteZcCarBrandByIds" parameterType="String">
|
||||
delete from zc_car_brand where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteZcCarModelByBrandIds" parameterType="String">
|
||||
delete from zc_car_model where brand_id in
|
||||
<foreach item="brandId" collection="array" open="(" separator="," close=")">
|
||||
#{brandId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteZcCarModelByBrandId" parameterType="Long">
|
||||
delete from zc_car_model where brand_id = #{brandId}
|
||||
</delete>
|
||||
|
||||
<insert id="batchZcCarModel">
|
||||
insert into zc_car_model( 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) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.modelName}, #{item.brandId}, #{item.brandName}, #{item.batteryType}, #{item.maxSpeed}, #{item.weight}, #{item.status}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, #{item.extend1}, #{item.extend2}, #{item.extend3})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@ -49,6 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectZcCarModelVo"/>
|
||||
<where>
|
||||
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</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="status != null and status != ''"> and status = #{status}</if>
|
||||
</where>
|
||||
@ -124,7 +125,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateZcCarModelBrand" parameterType="ZcCarModel">
|
||||
update zc_car_model set brand_name = #{brandName} where brand_id = #{brandId}
|
||||
</update>
|
||||
<delete id="deleteZcCarModelById" parameterType="Long">
|
||||
delete from zc_car_model where id = #{id}
|
||||
</delete>
|
||||
@ -141,6 +144,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectModelsByBrand" resultMap="ZcCarModelResult">
|
||||
SELECT id,model_name FROM zc_car_model WHERE del_flag = 0 and brand_name = #{brandName} ORDER BY model_name ASC
|
||||
SELECT id,model_name FROM zc_car_model WHERE del_flag = 0 and brand_id = #{brandId} ORDER BY model_name ASC
|
||||
</select>
|
||||
<select id="checkModelNameUnique" resultType="com.ruoyi.operation.domain.ZcCarModel">
|
||||
SELECT * FROM zc_car_model WHERE del_flag = 0 and brand_id = #{brandId} and model_name = #{modelName}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -22,7 +22,8 @@
|
||||
<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>
|
||||
<input type="hidden" id="brandName" name="brandName">
|
||||
<select name="brandId" id="brand-select" class="form-control m-b" required>
|
||||
<option value="">请选择品牌</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -126,23 +127,25 @@
|
||||
$(function () {
|
||||
// 加载品牌列表
|
||||
$.ajax({
|
||||
url: ctx + 'operation/carModel/brands',
|
||||
url: ctx + 'operation/carBrand/brands',
|
||||
type: 'GET',
|
||||
success: function (brands) {
|
||||
var brandSelect = $('#brand-select');
|
||||
brands.forEach(function (brand) {
|
||||
brandSelect.append('<option value="' + brand + '">' + brand + '</option>');
|
||||
brandSelect.append('<option value="' + brand.id + '">' + brand.brandName + '</option>');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 品牌选择变化时加载对应车型
|
||||
$('#brand-select').on('change', function () {
|
||||
var brandName = $(this).val();
|
||||
var brandId = $(this).val();
|
||||
var brandName = $(this).find("option:selected").text();
|
||||
$('#brandName').val(brandName);
|
||||
var modelSelect = $('#model-select');
|
||||
modelSelect.empty().append('<option value="">加载中...</option>').prop('disabled', true);
|
||||
|
||||
if (!brandName) {
|
||||
if (!brandId) {
|
||||
modelSelect.empty().append('<option value="">请先选择品牌</option>').prop('disabled', true);
|
||||
return;
|
||||
}
|
||||
@ -150,7 +153,7 @@
|
||||
$.ajax({
|
||||
url: ctx + 'operation/carModel/getModels',
|
||||
type: 'POST',
|
||||
data: { brandName: brandName },
|
||||
data: { brandId: brandId },
|
||||
success: function (models) {
|
||||
modelSelect.empty();
|
||||
if (models.length === 0) {
|
||||
@ -160,6 +163,9 @@
|
||||
modelSelect.append('<option value="' + model.id + '">' + model.modelName + '</option>');
|
||||
});
|
||||
modelSelect.prop('disabled', false);
|
||||
var modelName = $('#model-select option:selected').text();
|
||||
// 将门店名称赋值给隐藏输入框
|
||||
$("#modelName").val(modelName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -23,7 +23,8 @@
|
||||
<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>
|
||||
<input type="hidden" id="brandName" name="brandName" th:field="*{brandName}">
|
||||
<select name="brandId" id="brand-select" class="form-control m-b" required>
|
||||
<option value="">请选择品牌</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -118,19 +119,20 @@
|
||||
var modelSelect = $('#model-select');
|
||||
|
||||
// 保存当前车辆的品牌与车型值
|
||||
var savedBrand = [[${zcCar.brandName}]];
|
||||
var savedBrand = [[${zcCar.brandId}]];
|
||||
var savedBrandName = [[${zcCar.brandName}]];
|
||||
var modelId = [[${zcCar.modelId}]];
|
||||
var modelName = [[${zcCar.modelName}]];
|
||||
|
||||
// 加载品牌列表
|
||||
$.ajax({
|
||||
url: ctx + 'operation/carModel/brands',
|
||||
url: ctx + 'operation/carBrand/brands',
|
||||
type: 'GET',
|
||||
success: function (brands) {
|
||||
var brandSelect = $('#brand-select');
|
||||
brands.forEach(function (brand) {
|
||||
var option = $('<option>').val(brand).text(brand);
|
||||
if (brand === savedBrand) {
|
||||
var option = $('<option>').val(brand.id).text(brand.brandName);
|
||||
if (brand.id === savedBrand) {
|
||||
option.attr('selected', 'selected');
|
||||
}
|
||||
brandSelect.append(option);
|
||||
@ -150,6 +152,8 @@
|
||||
// =================== 品牌选择变化事件 ===================
|
||||
brandSelect.on('change', function () {
|
||||
var selectedBrand = $(this).val();
|
||||
var brandName = $(this).find("option:selected").text();
|
||||
$('#brandName').val(brandName);
|
||||
if (!selectedBrand) {
|
||||
modelSelect.empty().append('<option value="">请先选择品牌</option>').prop('disabled', true);
|
||||
return;
|
||||
@ -159,11 +163,11 @@
|
||||
});
|
||||
|
||||
// =================== 加载车型方法封装 ===================
|
||||
function loadModels(brandName, modelName = null) {
|
||||
function loadModels(brandId, modelName = null) {
|
||||
$.ajax({
|
||||
url: ctx + 'operation/carModel/getModels',
|
||||
type: 'POST',
|
||||
data: { brandName: brandName },
|
||||
data: { brandId: brandId },
|
||||
success: function (models) {
|
||||
modelSelect.empty();
|
||||
|
||||
@ -181,6 +185,9 @@
|
||||
// 设置隐藏域
|
||||
var selectedModelName = modelSelect.find('option:selected').text();
|
||||
$('#modelName').val(selectedModelName);
|
||||
}else{
|
||||
// 将门店名称赋值给隐藏输入框
|
||||
$("#modelName").val($('#model-select option:selected').text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,245 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增品牌管理')" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-carBrand-add">
|
||||
<!-- <h4 class="form-header h4">品牌管理信息</h4>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">品牌名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="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">
|
||||
<textarea name="brandIntro" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <h4 class="form-header h4">品牌车型</h4>-->
|
||||
<!-- <div class="row">-->
|
||||
<!-- <div class="col-sm-12">-->
|
||||
<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
|
||||
<!-- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
|
||||
<!-- <div class="col-sm-12 select-table table-striped">-->
|
||||
<!-- <table id="bootstrap-table"></table>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "operation/carBrand"
|
||||
var statusDatas = [[${@dict.getType('key_company_status')}]];
|
||||
$("#form-carBrand-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-carBrand-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
return columnIndex + $.table.serialNumber(index);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'modelName',
|
||||
align: 'center',
|
||||
title: '车型名称',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].modelName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'brandName',
|
||||
align: 'center',
|
||||
title: '品牌名称',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].brandName' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'batteryType',
|
||||
align: 'center',
|
||||
title: '电池类型',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].batteryType' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'maxSpeed',
|
||||
align: 'center',
|
||||
title: '最高时速(km/h)',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].maxSpeed' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'weight',
|
||||
align: 'center',
|
||||
title: '整车重量(kg)',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].weight' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
align: 'center',
|
||||
title: '状态',
|
||||
formatter: function(value, row, index) {
|
||||
var name = $.common.sprintf("zcCarModelList[%s].status", index);
|
||||
return $.common.dictToSelect(statusDatas, value, name);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'delFlag',
|
||||
align: 'center',
|
||||
title: '删除标志',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].delFlag' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createBy',
|
||||
align: 'center',
|
||||
title: '创建者',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].createBy' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
title: '创建时间',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].createTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'updateBy',
|
||||
align: 'center',
|
||||
title: '更新者',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].updateBy' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'updateTime',
|
||||
align: 'center',
|
||||
title: '更新时间',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].updateTime' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
align: 'center',
|
||||
title: '备注',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].remark' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'extend1',
|
||||
align: 'center',
|
||||
title: '扩展字段1',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].extend1' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'extend2',
|
||||
align: 'center',
|
||||
title: '扩展字段2',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].extend2' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'extend3',
|
||||
align: 'center',
|
||||
title: '扩展字段3',
|
||||
formatter: function(value, row, index) {
|
||||
var html = $.common.sprintf("<input class='form-control' type='text' name='zcCarModelList[%s].extend3' value='%s'>", index, value);
|
||||
return html;
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var value = $.common.isNotEmpty(row.index) ? row.index : $.table.serialNumber(index);
|
||||
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="sub.delRowByIndex(\'' + value + '\')"><i class="fa fa-remove"></i>删除</a>';
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function addRow() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
var row = {
|
||||
index: $.table.serialNumber(count),
|
||||
modelName: "",
|
||||
brandName: "",
|
||||
batteryType: "",
|
||||
maxSpeed: "",
|
||||
weight: "",
|
||||
status: "",
|
||||
delFlag: "",
|
||||
createBy: "",
|
||||
createTime: "",
|
||||
updateBy: "",
|
||||
updateTime: "",
|
||||
remark: "",
|
||||
extend1: "",
|
||||
extend2: "",
|
||||
extend3: "",
|
||||
}
|
||||
sub.addRow(row);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,92 @@
|
||||
<!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="brandName"/>
|
||||
</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="operation:carBrand:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="operation:carBrand:edit">
|
||||
<i class="fa fa-edit"></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:carBrand:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('operation:carBrand:remove')}]];
|
||||
var prefix = ctx + "operation/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: 'id',
|
||||
title: '车型ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'brandName',
|
||||
title: '品牌名称'
|
||||
},
|
||||
{
|
||||
field: 'brandIntro',
|
||||
title: '品牌介绍',
|
||||
width: '800'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
width: '200'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '200',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.editCustomize(\'' + row.id + '\',1300,700)"><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>
|
||||
@ -0,0 +1,146 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改品牌管理')" />
|
||||
</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="${zcCarBrand}">
|
||||
<h4 class="form-header h4">品牌信息</h4>
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">品牌名称:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="brandName" th:field="*{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">
|
||||
<textarea name="brandIntro" class="form-control">[[*{brandIntro}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<h4 class="form-header h4">品牌车型信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<!-- <button type="button" class="btn btn-white btn-sm" onclick="addRow()"><i class="fa fa-plus"> 增加</i></button>-->
|
||||
<!-- <button type="button" class="btn btn-white btn-sm" onclick="sub.delRow()"><i class="fa fa-minus"> 删除</i></button>-->
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "operation/carBrand";
|
||||
var statusDatas = [[${@dict.getType('key_company_status')}]];
|
||||
$("#form-carBrand-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-carBrand-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
data: [[${zcCarBrand.zcCarModelList}]],
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [
|
||||
{
|
||||
field: 'index',
|
||||
align: 'center',
|
||||
title: "序号",
|
||||
formatter: function (value, row, index) {
|
||||
var columnIndex = $.common.sprintf("<input type='hidden' name='index' value='%s'>", $.table.serialNumber(index));
|
||||
return columnIndex + $.table.serialNumber(index);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'modelName',
|
||||
align: 'center',
|
||||
title: '车型名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'brandName',
|
||||
align: 'center',
|
||||
title: '品牌名称'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'batteryType',
|
||||
align: 'center',
|
||||
title: '电池类型'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'maxSpeed',
|
||||
align: 'center',
|
||||
title: '最高时速(km/h)'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'weight',
|
||||
align: 'center',
|
||||
title: '整车重量(kg)'
|
||||
},
|
||||
|
||||
{
|
||||
field: 'status',
|
||||
align: 'center',
|
||||
title: '状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(statusDatas, value);
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
field: 'createTime',
|
||||
align: 'center',
|
||||
title: '创建时间'
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function addRow() {
|
||||
var count = $("#" + table.options.id).bootstrapTable('getData').length;
|
||||
var row = {
|
||||
index: $.table.serialNumber(count),
|
||||
modelName: "",
|
||||
brandName: "",
|
||||
batteryType: "",
|
||||
maxSpeed: "",
|
||||
weight: "",
|
||||
status: "",
|
||||
delFlag: "",
|
||||
createBy: "",
|
||||
createTime: "",
|
||||
updateBy: "",
|
||||
updateTime: "",
|
||||
remark: "",
|
||||
extend1: "",
|
||||
extend2: "",
|
||||
extend3: "",
|
||||
}
|
||||
sub.addRow(row);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -13,10 +13,14 @@
|
||||
<form class="form-horizontal m" id="form-carModel-add">
|
||||
|
||||
<input type="hidden" id="rentCarRuleIds" name="rentCarRuleIds">
|
||||
<input type="hidden" id="brandName" name="brandName">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label is-required">品牌名称:</label>
|
||||
<div class="col-sm-9">
|
||||
<input name="brandName" class="form-control" type="text" maxlength="20" required>
|
||||
<select name="brandId" id="brandId" class="form-control m-b" required>
|
||||
<option value="">请选择品牌</option>
|
||||
<option th:each="brand : ${carBrandList}" th:value="${brand.id}" th:text="${brand.brandName}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -127,8 +131,19 @@
|
||||
).on("filecleared", function (event, data, msg) {
|
||||
$("input[name='" + event.currentTarget.id + "']").val('')
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 品牌选择变化时
|
||||
$('#brandId').on('change', function () {
|
||||
var brandName = $(this).find("option:selected").text();
|
||||
$('#brandName').val(brandName);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
data: rentCarRuleList,
|
||||
|
||||
@ -13,7 +13,10 @@
|
||||
|
||||
<li>
|
||||
<label>品牌名称:</label>
|
||||
<input type="text" name="brandName"/>
|
||||
<select name="brandId" id="brandId" class="form-control m-b" required>
|
||||
<option value="">全部</option>
|
||||
<option th:each="brand : ${carBrandList}" th:value="${brand.id}" th:text="${brand.brandName}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>车型名称:</label>
|
||||
@ -84,7 +87,7 @@
|
||||
{
|
||||
field: 'modelName',
|
||||
title: '车型名称',
|
||||
width: '400'
|
||||
width: '200'
|
||||
},
|
||||
{
|
||||
field: 'batteryType',
|
||||
|
||||
@ -13,10 +13,17 @@
|
||||
<form class="form-horizontal m" id="form-carModel-edit" th:object="${zcCarModel}">
|
||||
<input name="id" th:field="*{id}" type="hidden">
|
||||
<input type="hidden" id="rentCarRuleIds" name="rentCarRuleIds">
|
||||
<input type="hidden" id="brandName" name="brandName" th:field="*{brandName}">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label is-required">品牌名称:</label>
|
||||
<div class="col-sm-9">
|
||||
<input name="brandName" th:field="*{brandName}" class="form-control" type="text" required>
|
||||
<select name="brandId" id="brandId" class="form-control m-b" required>
|
||||
<option value="">请选择品牌</option>
|
||||
<option th:each="brand : ${carBrandList}"
|
||||
th:value="${brand.id}"
|
||||
th:text="${brand.brandName}"
|
||||
th:selected="${brand.id == zcCarModel.brandId}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
@ -96,6 +103,11 @@
|
||||
var selectedValues = [[${zcCarModel.batteryType}]].split(',');
|
||||
$('.select2-multiple').val(selectedValues).trigger('change');
|
||||
|
||||
// 品牌选择变化时
|
||||
$('#brandId').on('change', function () {
|
||||
var brandName = $(this).find("option:selected").text();
|
||||
$('#brandName').val(brandName);
|
||||
});
|
||||
|
||||
var options = {
|
||||
data: rentCarRuleList,
|
||||
|
||||
@ -147,9 +147,9 @@
|
||||
align: "left",
|
||||
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.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.menuId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.menuId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-info btn-xs ' + addFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.add(\'' + row.menuId + '\')"><i class="fa fa-plus"></i>新增</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + ' btnOption" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.menuId + '\')"><i class="fa fa-trash"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
|
||||
@ -11,6 +11,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
@ -48,8 +50,14 @@ public class OssService {
|
||||
// 上传文件
|
||||
ossClient.putObject(putObjectRequest);
|
||||
|
||||
// 设置预签名URL过期时间,单位为亮秒。本示例以设置过期时间为1小时为例
|
||||
Date expiration = new Date(new Date().getTime()+ 3600 * 1000L);
|
||||
//生成以GET方法访问的预签名URL、本示例没有额外请求头,其他人可以直按通过湖览器访问相关内容
|
||||
URL url = ossClient.generatePresignedUrl(ossConfig.getBucketName(), objectName, expiration);
|
||||
System.out.println(url);
|
||||
return url.toString();
|
||||
// 返回文件访问 URL
|
||||
return "https://" + ossConfig.getDomain() + "/" + objectName;
|
||||
//return "https://" + ossConfig.getDomain() + "/" + objectName;
|
||||
} catch (com.aliyun.oss.OSSException e) {
|
||||
if ("AccessDenied".equals(e.getErrorCode())) {
|
||||
throw new IOException("OSS权限不足,请联系管理员配置权限。错误代码: " + e.getErrorCode(), e);
|
||||
|
||||
Reference in New Issue
Block a user