修复设备分类和设备型号问题
This commit is contained in:
@@ -32,11 +32,8 @@ public class TowerModelController extends BaseController {
|
||||
@ApiOperation("分页查询设备型号管理表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<TowerModel>> page(TowerModelParam param) {
|
||||
PageParam<TowerModel, TowerModelParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return success(towerModelService.page(page, page.getWrapper()));
|
||||
// 使用关联查询
|
||||
//return success(towerModelService.pageRel(param));
|
||||
return success(towerModelService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('tower:towerModel:list')")
|
||||
@@ -44,11 +41,8 @@ public class TowerModelController extends BaseController {
|
||||
@ApiOperation("查询全部设备型号管理表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<TowerModel>> list(TowerModelParam param) {
|
||||
PageParam<TowerModel, TowerModelParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return success(towerModelService.list(page.getOrderWrapper()));
|
||||
// 使用关联查询
|
||||
//return success(towerModelService.listRel(param));
|
||||
return success(towerModelService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('tower:towerModel:list')")
|
||||
@@ -56,9 +50,8 @@ public class TowerModelController extends BaseController {
|
||||
@ApiOperation("根据id查询设备型号管理表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<TowerModel> get(@PathVariable("id") Integer id) {
|
||||
return success(towerModelService.getById(id));
|
||||
// 使用关联查询
|
||||
//return success(towerModelService.getByIdRel(id));
|
||||
return success(towerModelService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('tower:towerModel:save')")
|
||||
|
||||
@@ -1,20 +1,18 @@
|
||||
package com.gxwebsoft.tower.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.time.LocalDate;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 配件管理
|
||||
*
|
||||
@@ -43,6 +41,9 @@ public class TowerAccessory implements Serializable {
|
||||
@ApiModelProperty(value = "适用设备型号")
|
||||
private String accessoryModel;
|
||||
|
||||
@ApiModelProperty(value = "适用设备型号(多选)")
|
||||
private String accessoryModelMultiple;
|
||||
|
||||
@ApiModelProperty(value = "配件规格")
|
||||
private String accessorySpecs;
|
||||
|
||||
|
||||
@@ -24,11 +24,14 @@ public class TowerModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "型号ID")
|
||||
@TableId(value = "category_id", type = IdType.AUTO)
|
||||
private Integer categoryId;
|
||||
@TableId(value = "model_id", type = IdType.AUTO)
|
||||
private Integer modelId;
|
||||
|
||||
@ApiModelProperty(value = "设备型号名称")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备型号")
|
||||
private String model;
|
||||
|
||||
@ApiModelProperty(value = "上级分类ID")
|
||||
private Integer parentId;
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
SELECT a.*
|
||||
FROM tower_model a
|
||||
<where>
|
||||
<if test="param.categoryId != null">
|
||||
AND a.category_id = #{param.categoryId}
|
||||
<if test="param.modelId != null">
|
||||
AND a.model_id = #{param.modelId}
|
||||
</if>
|
||||
<if test="param.title != null">
|
||||
AND a.title LIKE CONCAT('%', #{param.title}, '%')
|
||||
<if test="param.name != null">
|
||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
||||
</if>
|
||||
<if test="param.model != null">
|
||||
AND a.model LIKE CONCAT('%', #{param.model}, '%')
|
||||
</if>
|
||||
<if test="param.parentId != null">
|
||||
AND a.parent_id = #{param.parentId}
|
||||
@@ -46,6 +49,12 @@
|
||||
<if test="param.createTimeEnd != null">
|
||||
AND a.create_time <= #{param.createTimeEnd}
|
||||
</if>
|
||||
<if test="param.keywords != null">
|
||||
AND (
|
||||
a.name LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
OR a.model LIKE CONCAT('%', #{param.keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
|
||||
@@ -24,10 +24,13 @@ public class TowerModelParam extends BaseParam {
|
||||
|
||||
@ApiModelProperty(value = "型号ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
private Integer categoryId;
|
||||
private Integer modelId;
|
||||
|
||||
@ApiModelProperty(value = "设备型号名称")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "设备型号")
|
||||
private String model;
|
||||
|
||||
@ApiModelProperty(value = "上级分类ID")
|
||||
@QueryField(type = QueryType.EQ)
|
||||
|
||||
@@ -23,7 +23,7 @@ public class TowerModelServiceImpl extends ServiceImpl<TowerModelMapper, TowerMo
|
||||
@Override
|
||||
public PageResult<TowerModel> pageRel(TowerModelParam param) {
|
||||
PageParam<TowerModel, TowerModelParam> page = new PageParam<>(param);
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
page.setDefaultOrder("create_time desc");
|
||||
List<TowerModel> list = baseMapper.selectPageRel(page, param);
|
||||
return new PageResult<>(list, page.getTotal());
|
||||
}
|
||||
@@ -33,14 +33,14 @@ public class TowerModelServiceImpl extends ServiceImpl<TowerModelMapper, TowerMo
|
||||
List<TowerModel> list = baseMapper.selectListRel(param);
|
||||
// 排序
|
||||
PageParam<TowerModel, TowerModelParam> page = new PageParam<>();
|
||||
//page.setDefaultOrder("create_time desc");
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return page.sortRecords(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TowerModel getByIdRel(Integer categoryId) {
|
||||
public TowerModel getByIdRel(Integer modelId) {
|
||||
TowerModelParam param = new TowerModelParam();
|
||||
param.setCategoryId(categoryId);
|
||||
param.setModelId(modelId);
|
||||
return param.getOne(baseMapper.selectListRel(param));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user