Sfoglia il codice sorgente

一级市场生成订单商品表

linbl 1 anno fa
parent
commit
67c9c0f652

+ 172 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order_goods/TbOrderGoods.java

@@ -0,0 +1,172 @@
+package com.pj.tb_order_goods;
+
+import java.io.Serializable;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_order_goods -- 订单商品表
+ * @author lbl
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbOrderGoods.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbOrderGoods extends Model<TbOrderGoods> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id
+	 */
+	private static final long serialVersionUID = 1L;
+	/**
+	 * 此模块对应的表名
+	 */
+	public static final String TABLE_NAME = "tb_order_goods";
+	/**
+	 * 此模块对应的权限码
+	 */
+	public static final String PERMISSION_CODE = "tb-order-goods";
+	public static final String PERMISSION_CODE_ADD = "tb-order-goods-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-order-goods-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-order-goods-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键
+	 */
+	@TableId(type = IdType.AUTO)
+	@JsonSerialize(using = ToStringSerializer.class)
+	private Long id;
+	/**
+	 * 预申报编号
+	 */
+	private String platSeqNo;
+
+	/**
+	 * 边民备案号
+	 */
+	private String borderPutrecNo;
+
+	/**
+	 * 身份证号
+	 */
+	private String idno;
+
+	/**
+	 * 订单ID
+	 */
+	private Long orderId;
+
+	/**
+	 * 商品ID
+	 */
+	private Long goodsId;
+
+	/**
+	 * 商品编号
+	 */
+	private String goodsCode;
+
+	/**
+	 * 商品名称
+	 */
+	private String goodsName;
+
+	/**
+	 * 商品图片
+	 */
+	private String avatar;
+
+	/**
+	 * 购买金额
+	 */
+	private Double buyAmount;
+
+	/**
+	 * 净重
+	 */
+	private Double netWt;
+
+	/**
+	 * 毛重
+	 */
+	private Double grossWt;
+
+	/**
+	 * 购买数量
+	 */
+	private Double buyQty;
+
+	/**
+	 * 第一数量
+	 */
+	private Double buyQty1;
+
+	/**
+	 * 第二数量
+	 */
+	private Double buyQty2;
+
+	/**
+	 * 计价单位,如元、万等
+	 */
+	private String buyUnit;
+
+	/**
+	 * 数量单位,如kg、吨等
+	 */
+	private String numUnit;
+
+	/**
+	 * 创建人编号
+	 */
+	private String createBy;
+
+	/**
+	 * 创建人名称
+	 */
+	private String createName;
+
+	/**
+	 * 创建时间
+	 */
+	private String createTime;
+
+	/**
+	 * 更新人编号
+	 */
+	private String updateBy;
+
+	/**
+	 * 更新人名称
+	 */
+	private String updateName;
+
+	/**
+	 * 更新时间
+	 */
+	private String updateTime;
+
+	/**
+	 * 删除状态(0=禁用,1=启用)
+	 */
+	private String deleteStatus;
+
+
+
+
+
+
+
+
+}

+ 95 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order_goods/TbOrderGoodsController.java

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

+ 30 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order_goods/TbOrderGoodsMapper.java

@@ -0,0 +1,30 @@
+package com.pj.tb_order_goods;
+
+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_order_goods -- 订单商品表
+ * @author lbl 
+ */
+
+@Mapper
+@Repository
+public interface TbOrderGoodsMapper extends BaseMapper <TbOrderGoods> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbOrderGoods> getList(SoMap so);
+
+
+}

+ 89 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order_goods/TbOrderGoodsMapper.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.tb_order_goods.TbOrderGoodsMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, plat_seq_no, border_putrec_no, idno, order_id, goods_id, goods_code, goods_name, avatar, buy_amount, net_wt, gross_wt, buy_qty, buy_qty1, buy_qty2, buy_unit, num_unit, create_by, create_name, create_time, update_by, update_name, update_time, delete_status from tb_order_goods  -->
+
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.tb_order_goods.TbOrderGoods"></resultMap>
+
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select *
+		from tb_order_goods
+	</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("platSeqNo") '> and plat_seq_no = #{platSeqNo} </if>
+			<if test=' this.has("borderPutrecNo") '> and border_putrec_no = #{borderPutrecNo} </if>
+			<if test=' this.has("idno") '> and idno = #{idno} </if>
+			<if test=' this.has("orderId") '> and order_id = #{orderId} </if>
+			<if test=' this.has("goodsId") '> and goods_id = #{goodsId} </if>
+			<if test=' this.has("goodsCode") '> and goods_code = #{goodsCode} </if>
+			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
+			<if test=' this.has("avatar") '> and avatar = #{avatar} </if>
+			<if test=' this.has("buyAmount") '> and buy_amount = #{buyAmount} </if>
+			<if test=' this.has("netWt") '> and net_wt = #{netWt} </if>
+			<if test=' this.has("grossWt") '> and gross_wt = #{grossWt} </if>
+			<if test=' this.has("buyQty") '> and buy_qty = #{buyQty} </if>
+			<if test=' this.has("buyQty1") '> and buy_qty1 = #{buyQty1} </if>
+			<if test=' this.has("buyQty2") '> and buy_qty2 = #{buyQty2} </if>
+			<if test=' this.has("buyUnit") '> and buy_unit = #{buyUnit} </if>
+			<if test=' this.has("numUnit") '> and num_unit = #{numUnit} </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("createTime") '> and create_time = #{createTime} </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("updateTime") '> and update_time = #{updateTime} </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'> plat_seq_no desc </when>
+			<when test='sortType == 3'> border_putrec_no desc </when>
+			<when test='sortType == 4'> idno desc </when>
+			<when test='sortType == 5'> order_id desc </when>
+			<when test='sortType == 6'> goods_id desc </when>
+			<when test='sortType == 7'> goods_code desc </when>
+			<when test='sortType == 8'> goods_name desc </when>
+			<when test='sortType == 9'> avatar desc </when>
+			<when test='sortType == 10'> buy_amount desc </when>
+			<when test='sortType == 11'> net_wt desc </when>
+			<when test='sortType == 12'> gross_wt desc </when>
+			<when test='sortType == 13'> buy_qty desc </when>
+			<when test='sortType == 14'> buy_qty1 desc </when>
+			<when test='sortType == 15'> buy_qty2 desc </when>
+			<when test='sortType == 16'> buy_unit desc </when>
+			<when test='sortType == 17'> num_unit desc </when>
+			<when test='sortType == 18'> create_by desc </when>
+			<when test='sortType == 19'> create_name desc </when>
+			<when test='sortType == 20'> create_time desc </when>
+			<when test='sortType == 21'> update_by desc </when>
+			<when test='sortType == 22'> update_name desc </when>
+			<when test='sortType == 23'> update_time desc </when>
+			<when test='sortType == 24'> delete_status desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+
+
+
+
+
+
+
+
+
+
+</mapper>

+ 51 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order_goods/TbOrderGoodsService.java

@@ -0,0 +1,51 @@
+package com.pj.tb_order_goods;
+
+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_order_goods -- 订单商品表
+ * @author lbl 
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbOrderGoodsService extends ServiceImpl<TbOrderGoodsMapper, TbOrderGoods> implements IService<TbOrderGoods>{
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbOrderGoodsMapper tbOrderGoodsMapper;
+
+	/** 增 */
+	void add(TbOrderGoods t){
+		save(t);
+	}
+
+	/** 删 */
+	void delete(Long id){
+		removeById(id);
+	}
+
+	/** 改 */
+	void update(TbOrderGoods t){
+		updateById(t);
+
+	}
+
+	/** 查 */
+	TbOrderGoods getById(String id){
+		return super.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbOrderGoods> getList(SoMap so) { 
+		return tbOrderGoodsMapper.getList(so);	
+	}
+	
+
+}