Browse Source

添加商品物流信息增删查

loovi 1 year ago
parent
commit
ccda3fe0da

+ 170 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrders.java

@@ -0,0 +1,170 @@
+package com.pj.project.tb_orders;
+
+import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_orders -- 订单表
+ * @author loovi 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbOrders.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbOrders extends Model<TbOrders> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_orders";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-orders";
+	public static final String PERMISSION_CODE_ADD = "tb-orders-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-orders-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-orders-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 货运订单管理表主键 
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 * 一级市场订单ID 
+	 */
+	private Long levelOneOrderId;	
+
+	/**
+	 * 订单编号 
+	 */
+	private String orderNo;	
+
+	/**
+	 * 商品id 
+	 */
+	private Long goodsId;	
+
+	/**
+	 * 商品名称 
+	 */
+	private String goodsName;	
+
+	/**
+	 * 商品来源(国家) 
+	 */
+	private String goodsFrom;	
+
+	/**
+	 * 发货商电话 
+	 */
+	private String shipperPhone;	
+
+	/**
+	 * 发货商名称 
+	 */
+	private String shipperName;	
+
+	/**
+	 * 司机ID 
+	 */
+	private Long driverId;	
+
+	/**
+	 * 司机名称 
+	 */
+	private String driverName;	
+
+	/**
+	 * 司机电话 
+	 */
+	private String driverPhone;	
+
+	/**
+	 * 车型ID 
+	 */
+	private Long carId;	
+
+	/**
+	 * 车型名称 
+	 */
+	private String carType;	
+
+	/**
+	 * 收货人名称 
+	 */
+	private String consigneeName;	
+
+	/**
+	 * 收货人电话号码 
+	 */
+	private String consigneePhone;	
+
+	/**
+	 * (预留字段) 申报订单号 
+	 */
+	private String declarationNumber;	
+
+	/**
+	 * 订单状态已完成 (0=禁用,1=启用) 
+	 */
+	private Integer orderFinish;	
+
+	/**
+	 * 创建时间 
+	 */
+	private String createTime;	
+
+	/**
+	 * 创建人编号 
+	 */
+	private String createBy;	
+
+	/**
+	 * 创建人名称 
+	 */
+	private String createName;	
+
+	/**
+	 * 更新时间 
+	 */
+	private String updateTime;	
+
+	/**
+	 * 更新人编号 
+	 */
+	private String updateBy;	
+
+	/**
+	 * 更新人名称 
+	 */
+	private String updateName;	
+
+	/**
+	 * 删除状态(0=禁用,1=启用) 
+	 */
+	private Integer deleteStatus;	
+
+
+
+
+
+	
+
+
+}

+ 101 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrdersController.java

@@ -0,0 +1,101 @@
+package com.pj.project.tb_orders;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.project4sp.SP;
+import com.pj.utils.sg.AjaxJson;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+
+/**
+ * Controller: tb_orders -- 物流订单表
+ * @author loovi 
+ */
+@RestController
+@RequestMapping("/TbOrders/")
+public class TbOrdersController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbOrdersService tbOrdersService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbOrders t){
+		tbOrdersService.add(t);
+		t = tbOrdersService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbOrdersService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbOrders.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbOrders t){
+		tbOrdersService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbOrders.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		TbOrders t = tbOrdersService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(TbOrders.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbOrders> list = tbOrdersService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	/** 改 - 订单状态已完成 (0=禁用,1=启用) */  
+	@RequestMapping("updateOrderFinish")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT)
+	public AjaxJson updateOrderFinish(Long id, Integer value){
+		int line = SP.publicMapper.updateColumnById(TbOrders.TABLE_NAME, "order_finish", value, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 - 删除状态(0=禁用,1=启用) */  
+	@RequestMapping("updateDeleteStatus")
+	@SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT)
+	public AjaxJson updateDeleteStatus(Long id, Integer value){
+		int line = SP.publicMapper.updateColumnById(TbOrders.TABLE_NAME, "delete_status", value, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+
+	
+	
+	
+
+}

+ 30 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrdersMapper.java

@@ -0,0 +1,30 @@
+package com.pj.project.tb_orders;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_orders -- 订单表
+ * @author loovi 
+ */
+
+@Mapper
+@Repository
+public interface TbOrdersMapper extends BaseMapper <TbOrders> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbOrders> getList(SoMap so);
+
+
+}

+ 89 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrdersMapper.xml

@@ -0,0 +1,89 @@
+<?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.pj.project.tb_orders.TbOrdersMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, level_one_order_id, order_no, goods_id, goods_name, goods_from, shipper_phone, shipper_name, driver_id, driver_name, driver_phone, car_id, car_type, consignee_name, consignee_phone, declaration_number, order_finish, create_time, create_by, create_name, update_time, update_by, update_name, delete_status from tb_orders  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.project.tb_orders.TbOrders"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_orders 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("levelOneOrderId") '> and level_one_order_id = #{levelOneOrderId} </if>
+			<if test=' this.has("orderNo") '> and order_no = #{orderNo} </if>
+			<if test=' this.has("goodsId") '> and goods_id = #{goodsId} </if>
+			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
+			<if test=' this.has("goodsFrom") '> and goods_from = #{goodsFrom} </if>
+			<if test=' this.has("shipperPhone") '> and shipper_phone = #{shipperPhone} </if>
+			<if test=' this.has("shipperName") '> and shipper_name = #{shipperName} </if>
+			<if test=' this.has("driverId") '> and driver_id = #{driverId} </if>
+			<if test=' this.has("driverName") '> and driver_name = #{driverName} </if>
+			<if test=' this.has("driverPhone") '> and driver_phone = #{driverPhone} </if>
+			<if test=' this.has("carId") '> and car_id = #{carId} </if>
+			<if test=' this.has("carType") '> and car_type = #{carType} </if>
+			<if test=' this.has("consigneeName") '> and consignee_name = #{consigneeName} </if>
+			<if test=' this.has("consigneePhone") '> and consignee_phone = #{consigneePhone} </if>
+			<if test=' this.has("declarationNumber") '> and declaration_number = #{declarationNumber} </if>
+			<if test=' this.has("orderFinish") '> and order_finish = #{orderFinish} </if>
+			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
+			<if test=' this.has("createName") '> and create_name = #{createName} </if>
+			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
+			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
+			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
+			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> level_one_order_id desc </when>
+			<when test='sortType == 3'> order_no desc </when>
+			<when test='sortType == 4'> goods_id desc </when>
+			<when test='sortType == 5'> goods_name desc </when>
+			<when test='sortType == 6'> goods_from desc </when>
+			<when test='sortType == 7'> shipper_phone desc </when>
+			<when test='sortType == 8'> shipper_name desc </when>
+			<when test='sortType == 9'> driver_id desc </when>
+			<when test='sortType == 10'> driver_name desc </when>
+			<when test='sortType == 11'> driver_phone desc </when>
+			<when test='sortType == 12'> car_id desc </when>
+			<when test='sortType == 13'> car_type desc </when>
+			<when test='sortType == 14'> consignee_name desc </when>
+			<when test='sortType == 15'> consignee_phone desc </when>
+			<when test='sortType == 16'> declaration_number desc </when>
+			<when test='sortType == 17'> order_finish desc </when>
+			<when test='sortType == 18'> create_time desc </when>
+			<when test='sortType == 19'> create_by desc </when>
+			<when test='sortType == 20'> create_name desc </when>
+			<when test='sortType == 21'> update_time desc </when>
+			<when test='sortType == 22'> update_by desc </when>
+			<when test='sortType == 23'> update_name desc </when>
+			<when test='sortType == 24'> delete_status desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 51 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrdersService.java

@@ -0,0 +1,51 @@
+package com.pj.project.tb_orders;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_orders -- 订单表
+ * @author loovi 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> implements IService<TbOrders>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbOrdersMapper tbOrdersMapper;
+
+	/** 增 */
+	void add(TbOrders t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbOrders t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbOrders getById(Long id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbOrders> getList(SoMap so) { 
+		return tbOrdersMapper.getList(so);	
+	}
+	
+
+}

+ 91 - 0
sp-service/transport-server/src/main/java/com/pj/project/tb_orders/TbOrdersUtil.java

@@ -0,0 +1,91 @@
+package com.pj.project.tb_orders;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.pj.utils.sg.*;
+
+/**
+ * 工具类:tb_orders -- 订单表
+ * @author loovi 
+ *
+ */
+@Component
+public class TbOrdersUtil {
+
+	
+	/** 底层 Mapper 对象 */
+	public static TbOrdersMapper tbOrdersMapper;
+	@Autowired
+	private void setTbOrdersMapper(TbOrdersMapper tbOrdersMapper) {
+		TbOrdersUtil.tbOrdersMapper = tbOrdersMapper;
+	}
+	
+	
+	/** 
+	 * 将一个 TbOrders 对象进行进行数据完整性校验 (方便add/update等接口数据校验) [G] 
+	 */
+	static void check(TbOrders t) {
+		AjaxError.throwByIsNull(t.getId(), "[货运订单管理表主键] 不能为空");		// 验证: 货运订单管理表主键 
+		AjaxError.throwByIsNull(t.getLevelOneOrderId(), "[一级市场订单ID] 不能为空");		// 验证: 一级市场订单ID 
+		AjaxError.throwByIsNull(t.getOrderNo(), "[订单编号] 不能为空");		// 验证: 订单编号 
+		AjaxError.throwByIsNull(t.getGoodsId(), "[商品id] 不能为空");		// 验证: 商品id 
+		AjaxError.throwByIsNull(t.getGoodsName(), "[商品名称] 不能为空");		// 验证: 商品名称 
+		AjaxError.throwByIsNull(t.getGoodsFrom(), "[商品来源] 不能为空");		// 验证: 商品来源(国家) 
+		AjaxError.throwByIsNull(t.getShipperPhone(), "[发货商电话] 不能为空");		// 验证: 发货商电话 
+		AjaxError.throwByIsNull(t.getShipperName(), "[发货商名称] 不能为空");		// 验证: 发货商名称 
+		AjaxError.throwByIsNull(t.getDriverId(), "[司机ID] 不能为空");		// 验证: 司机ID 
+		AjaxError.throwByIsNull(t.getDriverName(), "[司机名称] 不能为空");		// 验证: 司机名称 
+		AjaxError.throwByIsNull(t.getDriverPhone(), "[司机电话] 不能为空");		// 验证: 司机电话 
+		AjaxError.throwByIsNull(t.getCarId(), "[车型ID] 不能为空");		// 验证: 车型ID 
+		AjaxError.throwByIsNull(t.getCarType(), "[车型名称] 不能为空");		// 验证: 车型名称 
+		AjaxError.throwByIsNull(t.getConsigneeName(), "[收货人名称] 不能为空");		// 验证: 收货人名称 
+		AjaxError.throwByIsNull(t.getConsigneePhone(), "[收货人电话号码] 不能为空");		// 验证: 收货人电话号码 
+		AjaxError.throwByIsNull(t.getDeclarationNumber(), "[申报订单号] 不能为空");		// 验证: (预留字段) 申报订单号 
+		AjaxError.throwByIsNull(t.getOrderFinish(), "[订单状态已完成] 不能为空");		// 验证: 订单状态已完成 (0=禁用,1=启用) 
+		AjaxError.throwByIsNull(t.getCreateTime(), "[创建时间] 不能为空");		// 验证: 创建时间 
+		AjaxError.throwByIsNull(t.getCreateBy(), "[创建人编号] 不能为空");		// 验证: 创建人编号 
+		AjaxError.throwByIsNull(t.getCreateName(), "[创建人名称] 不能为空");		// 验证: 创建人名称 
+		AjaxError.throwByIsNull(t.getUpdateTime(), "[更新时间] 不能为空");		// 验证: 更新时间 
+		AjaxError.throwByIsNull(t.getUpdateBy(), "[更新人编号] 不能为空");		// 验证: 更新人编号 
+		AjaxError.throwByIsNull(t.getUpdateName(), "[更新人名称] 不能为空");		// 验证: 更新人名称 
+		AjaxError.throwByIsNull(t.getDeleteStatus(), "[删除状态] 不能为空");		// 验证: 删除状态(0=禁用,1=启用) 
+	}
+
+	/** 
+	 * 获取一个TbOrders (方便复制代码用) [G] 
+	 */ 
+	static TbOrders getTbOrders() {
+		TbOrders t = new TbOrders();	// 声明对象 
+		t.setId(0L);		// 货运订单管理表主键 
+		t.setLevelOneOrderId(0L);		// 一级市场订单ID 
+		t.setOrderNo("");		// 订单编号 
+		t.setGoodsId(0L);		// 商品id 
+		t.setGoodsName("");		// 商品名称 
+		t.setGoodsFrom("");		// 商品来源(国家) 
+		t.setShipperPhone("");		// 发货商电话 
+		t.setShipperName("");		// 发货商名称 
+		t.setDriverId(0L);		// 司机ID 
+		t.setDriverName("");		// 司机名称 
+		t.setDriverPhone("");		// 司机电话 
+		t.setCarId(0L);		// 车型ID 
+		t.setCarType("");		// 车型名称 
+		t.setConsigneeName("");		// 收货人名称 
+		t.setConsigneePhone("");		// 收货人电话号码 
+		t.setDeclarationNumber("");		// (预留字段) 申报订单号 
+		t.setOrderFinish(0);		// 订单状态已完成 (0=禁用,1=启用) 
+		t.setCreateTime("");		// 创建时间 
+		t.setCreateBy("");		// 创建人编号 
+		t.setCreateName("");		// 创建人名称 
+		t.setUpdateTime("");		// 更新时间 
+		t.setUpdateBy("");		// 更新人编号 
+		t.setUpdateName("");		// 更新人名称 
+		t.setDeleteStatus(0);		// 删除状态(0=禁用,1=启用) 
+		return t;
+	}
+	
+	
+	
+	
+	
+}