中心仓库
This commit is contained in:
parent
07c182b9fe
commit
544cb4b3ff
@ -0,0 +1,94 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.controller;
|
||||||
|
|
||||||
|
import com.tmerclub.cloud.common.database.dto.PageDTO;
|
||||||
|
import com.tmerclub.cloud.common.database.vo.PageVO;
|
||||||
|
import com.tmerclub.cloud.common.response.ServerResponseEntity;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.dto.WarehouseDTO;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.vo.WarehouseVO;
|
||||||
|
import com.tmerclub.cloud.warehouse.service.WarehouseService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
@Tag(name = "后管-仓库")
|
||||||
|
@RestController("adminWarehouseController")
|
||||||
|
@RequestMapping("/admin/warehouse")
|
||||||
|
public class WarehouseController {
|
||||||
|
@Resource
|
||||||
|
WarehouseService warehouseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询
|
||||||
|
*
|
||||||
|
* @param pageDTO 分页参数
|
||||||
|
* @param warehouseDTO 查询参数
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "查询仓库分页列表", description = "查询仓库分页列表")
|
||||||
|
public ServerResponseEntity<PageVO<WarehouseVO>> page(@Valid PageDTO pageDTO, WarehouseDTO warehouseDTO) {
|
||||||
|
PageVO<WarehouseVO> warehousePage = warehouseService.page(pageDTO, warehouseDTO);
|
||||||
|
return ServerResponseEntity.success(warehousePage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据主键id获取仓库
|
||||||
|
*
|
||||||
|
* @param id 主键id
|
||||||
|
* @return WarehouseVO
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
@Operation(summary = "根据id获取仓库", description = "根据id获取仓库")
|
||||||
|
public ServerResponseEntity<WarehouseVO> getById(@RequestParam Long id) {
|
||||||
|
WarehouseVO warehouse = warehouseService.getById(id);
|
||||||
|
return ServerResponseEntity.success(warehouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增仓库
|
||||||
|
*
|
||||||
|
* @param warehouseDTO WarehouseDTO
|
||||||
|
* @return ServerResponseEntity
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "新增仓库", description = "新增仓库")
|
||||||
|
public ServerResponseEntity<Void> save(@Valid @RequestBody WarehouseDTO warehouseDTO) {
|
||||||
|
int insert = warehouseService.save(warehouseDTO);
|
||||||
|
return insert > 0 ? ServerResponseEntity.success() : ServerResponseEntity.showFailMsg("保存失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改仓库
|
||||||
|
*
|
||||||
|
* @param warehouseDTO WarehouseDTO
|
||||||
|
* @return ServerResponseEntity
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
@Operation(summary = "修改仓库", description = "修改仓库")
|
||||||
|
public ServerResponseEntity<Void> update(@Valid @RequestBody WarehouseDTO warehouseDTO) {
|
||||||
|
int update = warehouseService.update(warehouseDTO);
|
||||||
|
return update > 0 ? ServerResponseEntity.success() : ServerResponseEntity.showFailMsg("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除仓库
|
||||||
|
*
|
||||||
|
* @param id 主键id
|
||||||
|
* @return ServerResponseEntity
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
@Operation(summary = "删除仓库", description = "删除仓库")
|
||||||
|
public ServerResponseEntity<Void> delete(@RequestParam Long id) {
|
||||||
|
int delete = warehouseService.delete(id);
|
||||||
|
return delete > 0 ? ServerResponseEntity.success() : ServerResponseEntity.showFailMsg("删除失败");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.mapper;
|
||||||
|
|
||||||
|
import com.tmerclub.cloud.warehouse.model.Warehouse;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.dto.WarehouseDTO;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.vo.WarehouseVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库Mapper接口
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
public interface WarehouseMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询仓库列表
|
||||||
|
*
|
||||||
|
* @param warehouseDTO 查询参数
|
||||||
|
* @return 仓库列表数据
|
||||||
|
*/
|
||||||
|
List<WarehouseVO> list(@Param("dto") WarehouseDTO warehouseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取仓库详情
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 仓库详情
|
||||||
|
*/
|
||||||
|
WarehouseVO getById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增仓库
|
||||||
|
*
|
||||||
|
* @param warehouse 新增参数
|
||||||
|
* @return 新增结果
|
||||||
|
*/
|
||||||
|
int save(Warehouse warehouse);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改仓库
|
||||||
|
*
|
||||||
|
* @param warehouse 修改参数
|
||||||
|
* @return 修改结果
|
||||||
|
*/
|
||||||
|
int update(Warehouse warehouse);
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.model;
|
||||||
|
|
||||||
|
import com.tmerclub.cloud.common.model.BaseModel;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库对象
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class Warehouse extends BaseModel implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long warehouseId;
|
||||||
|
/**
|
||||||
|
* 仓库名称
|
||||||
|
*/
|
||||||
|
private String warehouseName;
|
||||||
|
/**
|
||||||
|
* 状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
private Integer warehouseStatus;
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String principalName;
|
||||||
|
/**
|
||||||
|
* 负责人电话
|
||||||
|
*/
|
||||||
|
private String principalPhone;
|
||||||
|
/**
|
||||||
|
* 省ID
|
||||||
|
*/
|
||||||
|
private Long provinceId;
|
||||||
|
/**
|
||||||
|
* 省
|
||||||
|
*/
|
||||||
|
private String province;
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
private Long cityId;
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
/**
|
||||||
|
* 区ID
|
||||||
|
*/
|
||||||
|
private Long areaId;
|
||||||
|
/**
|
||||||
|
* 区
|
||||||
|
*/
|
||||||
|
private String area;
|
||||||
|
/**
|
||||||
|
* 邮编
|
||||||
|
*/
|
||||||
|
private String postCode;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String addr;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private BigDecimal lng;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private BigDecimal lat;
|
||||||
|
/**
|
||||||
|
* 删除状态 0-未删除 1-已删除
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.model.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库对象
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WarehouseDTO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
private Long warehouseId;
|
||||||
|
/**
|
||||||
|
* 仓库名称
|
||||||
|
*/
|
||||||
|
private String warehouseName;
|
||||||
|
/**
|
||||||
|
* 状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
private Integer warehouseStatus;
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String principalName;
|
||||||
|
/**
|
||||||
|
* 负责人电话
|
||||||
|
*/
|
||||||
|
private String principalPhone;
|
||||||
|
/**
|
||||||
|
* 省ID
|
||||||
|
*/
|
||||||
|
private Long provinceId;
|
||||||
|
/**
|
||||||
|
* 省
|
||||||
|
*/
|
||||||
|
private String province;
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
private Long cityId;
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
private String city;
|
||||||
|
/**
|
||||||
|
* 区ID
|
||||||
|
*/
|
||||||
|
private Long areaId;
|
||||||
|
/**
|
||||||
|
* 区
|
||||||
|
*/
|
||||||
|
private String area;
|
||||||
|
/**
|
||||||
|
* 邮编
|
||||||
|
*/
|
||||||
|
private String postCode;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
private String addr;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
private BigDecimal lng;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
private BigDecimal lat;
|
||||||
|
/**
|
||||||
|
* 删除状态 0-未删除 1-已删除
|
||||||
|
*/
|
||||||
|
private Integer deleted;
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.model.vo;
|
||||||
|
|
||||||
|
import com.tmerclub.cloud.common.vo.BaseVO;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库视图对象
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class WarehouseVO extends BaseVO implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "主键ID")
|
||||||
|
private Long warehouseId;
|
||||||
|
/**
|
||||||
|
* 仓库名称
|
||||||
|
*/
|
||||||
|
@Schema(description = "仓库名称")
|
||||||
|
private String warehouseName;
|
||||||
|
/**
|
||||||
|
* 状态:0-禁用,1-启用
|
||||||
|
*/
|
||||||
|
@Schema(description = "状态:0-禁用,1-启用")
|
||||||
|
private Integer warehouseStatus;
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
@Schema(description = "负责人姓名")
|
||||||
|
private String principalName;
|
||||||
|
/**
|
||||||
|
* 负责人电话
|
||||||
|
*/
|
||||||
|
@Schema(description = "负责人电话")
|
||||||
|
private String principalPhone;
|
||||||
|
/**
|
||||||
|
* 省ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "省ID")
|
||||||
|
private Long provinceId;
|
||||||
|
/**
|
||||||
|
* 省
|
||||||
|
*/
|
||||||
|
@Schema(description = "省")
|
||||||
|
private String province;
|
||||||
|
/**
|
||||||
|
* 城市ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "城市ID")
|
||||||
|
private Long cityId;
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
@Schema(description = "城市")
|
||||||
|
private String city;
|
||||||
|
/**
|
||||||
|
* 区ID
|
||||||
|
*/
|
||||||
|
@Schema(description = "区ID")
|
||||||
|
private Long areaId;
|
||||||
|
/**
|
||||||
|
* 区
|
||||||
|
*/
|
||||||
|
@Schema(description = "区")
|
||||||
|
private String area;
|
||||||
|
/**
|
||||||
|
* 邮编
|
||||||
|
*/
|
||||||
|
@Schema(description = "邮编")
|
||||||
|
private String postCode;
|
||||||
|
/**
|
||||||
|
* 地址
|
||||||
|
*/
|
||||||
|
@Schema(description = "地址")
|
||||||
|
private String addr;
|
||||||
|
/**
|
||||||
|
* 经度
|
||||||
|
*/
|
||||||
|
@Schema(description = "经度")
|
||||||
|
private BigDecimal lng;
|
||||||
|
/**
|
||||||
|
* 纬度
|
||||||
|
*/
|
||||||
|
@Schema(description = "纬度")
|
||||||
|
private BigDecimal lat;
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.service;
|
||||||
|
|
||||||
|
import com.tmerclub.cloud.common.database.dto.PageDTO;
|
||||||
|
import com.tmerclub.cloud.common.database.vo.PageVO;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.dto.WarehouseDTO;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.vo.WarehouseVO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库Service接口
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
public interface WarehouseService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取仓库分页列表
|
||||||
|
*
|
||||||
|
* @param pageDTO 分页参数
|
||||||
|
* @param warehouseDTO 查询参数
|
||||||
|
* @return 分页数据
|
||||||
|
*/
|
||||||
|
PageVO<WarehouseVO> page(PageDTO pageDTO, WarehouseDTO warehouseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取仓库详情
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 仓库详情
|
||||||
|
*/
|
||||||
|
WarehouseVO getById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增仓库
|
||||||
|
*
|
||||||
|
* @param warehouseDTO 新增参数
|
||||||
|
* @return 新增结果
|
||||||
|
*/
|
||||||
|
int save(WarehouseDTO warehouseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改仓库
|
||||||
|
*
|
||||||
|
* @param warehouseDTO 修改参数
|
||||||
|
* @return 修改结果
|
||||||
|
*/
|
||||||
|
int update(WarehouseDTO warehouseDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除仓库
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 删除结果
|
||||||
|
*/
|
||||||
|
int delete(Long id);
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.tmerclub.cloud.warehouse.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.tmerclub.cloud.common.database.dto.PageDTO;
|
||||||
|
import com.tmerclub.cloud.common.database.util.PageUtil;
|
||||||
|
import com.tmerclub.cloud.common.database.vo.PageVO;
|
||||||
|
import com.tmerclub.cloud.warehouse.mapper.WarehouseMapper;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.Warehouse;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.dto.WarehouseDTO;
|
||||||
|
import com.tmerclub.cloud.warehouse.model.vo.WarehouseVO;
|
||||||
|
import com.tmerclub.cloud.warehouse.service.WarehouseService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库Service实现类
|
||||||
|
*
|
||||||
|
* @author : frank
|
||||||
|
* @create : 2025-04-14
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WarehouseServiceImpl implements WarehouseService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
WarehouseMapper warehouseMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageVO<WarehouseVO> page(PageDTO pageDTO, WarehouseDTO warehouseDTO) {
|
||||||
|
return PageUtil.doPage(pageDTO, () -> warehouseMapper.list(warehouseDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WarehouseVO getById(Long id) {
|
||||||
|
return warehouseMapper.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int save(WarehouseDTO warehouseDTO) {
|
||||||
|
Warehouse warehouse = BeanUtil.toBean(warehouseDTO, Warehouse.class);
|
||||||
|
warehouse.setCreateTime(DateUtil.date());
|
||||||
|
return warehouseMapper.save(warehouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int update(WarehouseDTO warehouseDTO) {
|
||||||
|
Warehouse warehouse = BeanUtil.toBean(warehouseDTO, Warehouse.class);
|
||||||
|
warehouse.setUpdateTime(DateUtil.date());
|
||||||
|
return warehouseMapper.update(warehouse);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(Long id) {
|
||||||
|
WarehouseVO warehouseVO = warehouseMapper.getById(id);
|
||||||
|
Warehouse warehouse = BeanUtil.toBean(warehouseVO, Warehouse.class);
|
||||||
|
warehouse.setUpdateTime(DateUtil.date());
|
||||||
|
warehouse.setDeleted(1);
|
||||||
|
return warehouseMapper.update(warehouse);
|
||||||
|
}
|
||||||
|
}
|
168
tmerclub-local/src/main/resources/mapper/WarehouseMapper.xml
Normal file
168
tmerclub-local/src/main/resources/mapper/WarehouseMapper.xml
Normal file
@ -0,0 +1,168 @@
|
|||||||
|
<?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.tmerclub.cloud.warehouse.mapper.WarehouseMapper">
|
||||||
|
|
||||||
|
<!-- 可根据自己的需求,是否要使用 -->
|
||||||
|
<resultMap id="warehouseVOMap" type="com.tmerclub.cloud.warehouse.model.vo.WarehouseVO">
|
||||||
|
<result property="warehouseId" column="warehouse_id"/>
|
||||||
|
<result property="warehouseName" column="warehouse_name"/>
|
||||||
|
<result property="warehouseStatus" column="warehouse_status"/>
|
||||||
|
<result property="principalName" column="principal_name"/>
|
||||||
|
<result property="principalPhone" column="principal_phone"/>
|
||||||
|
<result property="provinceId" column="province_id"/>
|
||||||
|
<result property="province" column="province"/>
|
||||||
|
<result property="cityId" column="city_id"/>
|
||||||
|
<result property="city" column="city"/>
|
||||||
|
<result property="areaId" column="area_id"/>
|
||||||
|
<result property="area" column="area"/>
|
||||||
|
<result property="postCode" column="post_code"/>
|
||||||
|
<result property="addr" column="addr"/>
|
||||||
|
<result property="lng" column="lng"/>
|
||||||
|
<result property="lat" column="lat"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="Vo_Column_List">
|
||||||
|
warehouse_id,warehouse_name,warehouse_status,principal_name,principal_phone,province_id,province,city_id,city,area_id,area,post_code,addr,lng,lat,deleted,update_time,create_time
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="list" resultMap="warehouseVOMap">
|
||||||
|
SELECT
|
||||||
|
<include refid="Vo_Column_List" />
|
||||||
|
FROM
|
||||||
|
warehouse
|
||||||
|
<where>
|
||||||
|
deleted = 0
|
||||||
|
<if test="dto.warehouseName != null and dto.warehouseName != ''">
|
||||||
|
AND warehouse_name LIKE CONCAT('%', #{dto.warehouseName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.warehouseStatus != null">
|
||||||
|
AND warehouse_status = #{dto.warehouseStatus}
|
||||||
|
</if>
|
||||||
|
<if test="dto.provinceId != null">
|
||||||
|
AND province_id = #{dto.provinceId}
|
||||||
|
</if>
|
||||||
|
<if test="dto.cityId != null">
|
||||||
|
AND city_id = #{dto.cityId}
|
||||||
|
</if>
|
||||||
|
<if test="dto.areaId != null">
|
||||||
|
AND area_id = #{dto.areaId}
|
||||||
|
</if>
|
||||||
|
<if test="dto.postCode != null and dto.postCode != ''">
|
||||||
|
AND post_code LIKE CONCAT('%', #{dto.postCode}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.principalName != null and dto.principalName != ''">
|
||||||
|
AND principal_name LIKE CONCAT('%', #{dto.principalName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.principalPhone != null and dto.principalPhone != ''">
|
||||||
|
AND principal_phone LIKE CONCAT('%', #{dto.principalPhone}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="dto.addr != null and dto.addr != ''">
|
||||||
|
AND addr LIKE CONCAT('%', #{dto.addr}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
ORDER BY
|
||||||
|
warehouse_id DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getById" resultMap="warehouseVOMap">
|
||||||
|
SELECT
|
||||||
|
<include refid="Vo_Column_List" />
|
||||||
|
FROM
|
||||||
|
warehouse
|
||||||
|
WHERE
|
||||||
|
warehouse_id = #{warehouseId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="save" useGeneratedKeys="true" keyProperty="warehouseId">
|
||||||
|
INSERT INTO warehouse
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
|
||||||
|
<if test="warehouseStatus != null">warehouse_status,</if>
|
||||||
|
<if test="principalName != null and principalName != ''">principal_name,</if>
|
||||||
|
<if test="principalPhone != null and principalPhone != ''">principal_phone,</if>
|
||||||
|
<if test="provinceId != null">province_id,</if>
|
||||||
|
<if test="province != null and province != ''">province,</if>
|
||||||
|
<if test="cityId != null">city_id,</if>
|
||||||
|
<if test="city != null and city != ''">city,</if>
|
||||||
|
<if test="areaId != null">area_id,</if>
|
||||||
|
<if test="area != null">area,</if>
|
||||||
|
<if test="postCode != null">post_code,</if>
|
||||||
|
<if test="addr != null and area != ''">addr,</if>
|
||||||
|
<if test="lng != null">lng,</if>
|
||||||
|
<if test="lat != null">lat,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
|
||||||
|
<if test="warehouseStatus != null">#{warehouseStatus},</if>
|
||||||
|
<if test="principalName != null and principalName != ''">#{principalName},</if>
|
||||||
|
<if test="principalPhone != null and principalPhone != ''">#{principalPhone},</if>
|
||||||
|
<if test="provinceId != null">#{provinceId},</if>
|
||||||
|
<if test="province != null and province != ''">#{province},</if>
|
||||||
|
<if test="cityId != null">#{cityId},</if>
|
||||||
|
<if test="city != null and city != ''">#{city},</if>
|
||||||
|
<if test="areaId != null">#{areaId},</if>
|
||||||
|
<if test="area != null and area != ''">#{area},</if>
|
||||||
|
<if test="postCode != null">#{postCode},</if>
|
||||||
|
<if test="addr != null">#{addr},</if>
|
||||||
|
<if test="lng != null">#{lng},</if>
|
||||||
|
<if test="lat != null">#{lat},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="update">
|
||||||
|
UPDATE warehouse
|
||||||
|
<set>
|
||||||
|
<if test="warehouseName != null and warehouseName != ''">
|
||||||
|
warehouse_name = #{warehouseName},
|
||||||
|
</if>
|
||||||
|
<if test="warehouseStatus != null">
|
||||||
|
warehouse_status = #{warehouseStatus},
|
||||||
|
</if>
|
||||||
|
<if test="principalName != null and principalName != ''">
|
||||||
|
principal_name = #{principalName},
|
||||||
|
</if>
|
||||||
|
<if test="principalPhone != null and principalPhone != ''">
|
||||||
|
principal_phone = #{principalPhone},
|
||||||
|
</if>
|
||||||
|
<if test="provinceId != null">
|
||||||
|
province_id = #{provinceId},
|
||||||
|
</if>
|
||||||
|
<if test="province != null and province != ''">
|
||||||
|
province = #{province},
|
||||||
|
</if>
|
||||||
|
<if test="cityId != null">
|
||||||
|
city_id = #{cityId},
|
||||||
|
</if>
|
||||||
|
<if test="city != null and city != ''">
|
||||||
|
city = #{city},
|
||||||
|
</if>
|
||||||
|
<if test="areaId != null">
|
||||||
|
area_id = #{areaId},
|
||||||
|
</if>
|
||||||
|
<if test="area != null and area != ''">
|
||||||
|
area = #{area},
|
||||||
|
</if>
|
||||||
|
<if test="postCode != null and postCode != ''">
|
||||||
|
post_code = #{postCode},
|
||||||
|
</if>
|
||||||
|
<if test="addr != null and addr != ''">
|
||||||
|
addr = #{addr},
|
||||||
|
</if>
|
||||||
|
<if test="lng != null">
|
||||||
|
lng = #{lng},
|
||||||
|
</if>
|
||||||
|
<if test="lat != null">
|
||||||
|
lat = #{lat},
|
||||||
|
</if>
|
||||||
|
<if test="deleted != null">
|
||||||
|
deleted = #{deleted},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where warehouse_id = #{warehouseId}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
Loading…
x
Reference in New Issue
Block a user