Quellcode durchsuchen

申报信息表

lzm vor 3 Jahren
Ursprung
Commit
73394e518c

+ 168 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclare.java

@@ -0,0 +1,168 @@
+package com.pj.project.tb_declare;
+
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_declare -- 
+ * @author lzm 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbDeclare.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbDeclare implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_declare";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-declare";	
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 * 主键 
+	 */
+	public Long id;	
+
+	/**
+	 * 业务id 
+	 */
+	public Long businessId;	
+
+	/**
+	 * 产品学名 
+	 */
+	public String goodsName;	
+
+	/**
+	 * 毛重 
+	 */
+	public Double grossWeight;	
+
+	/**
+	 * 件数 
+	 */
+	public Integer num;	
+
+	/**
+	 * 生产日期 
+	 */
+	public String productionDate;	
+
+	/**
+	 * 保质期 
+	 */
+	public String expirationDate;	
+
+	/**
+	 * 储存条件 
+	 */
+	public String storageMode;	
+
+	/**
+	 * 生产方式 
+	 */
+	public String productionMode;	
+
+	/**
+	 * 原产国 
+	 */
+	public String origin;	
+
+	/**
+	 * 进口冷链食品生产商注册号 
+	 */
+	public String producerCode;	
+
+	/**
+	 * 货主单位 
+	 */
+	public String sendUnit;	
+
+	/**
+	 * 收货单位 
+	 */
+	public String receiveUnit;	
+
+	/**
+	 * 货物流向 
+	 */
+	public String route;	
+
+	/**
+	 * 司机姓名 
+	 */
+	public String driverName;	
+
+	/**
+	 * 联系电话(司机) 
+	 */
+	public String driverPhone;	
+
+	/**
+	 * 代理商 
+	 */
+	public String agent;	
+
+	/**
+	 * 联系电话(代理人) 
+	 */
+	public String agentPhone;	
+
+	/**
+	 * 运输车车牌 
+	 */
+	public String chinaCarNo;	
+
+	/**
+	 * 越南车车牌 
+	 */
+	public String carNo;	
+
+	/**
+	 * 海关报关单据 
+	 */
+	public String customProof;	
+
+	/**
+	 * 进口检验检疫证书 
+	 */
+	public String quarantineProof;	
+
+	/**
+	 * 商铺(互助组) 
+	 */
+	public String shop;	
+
+	/**
+	 * 生产批号 
+	 */
+	public String productionCode;	
+
+	/**
+	 * 柜号 
+	 */
+	public String containerCode;	
+
+
+
+
+
+	
+
+
+}

+ 105 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareController.java

@@ -0,0 +1,105 @@
+package com.pj.project.tb_declare;
+
+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_declare -- 
+ * @author lzm 
+ */
+@RestController
+@RequestMapping("/TbDeclare/")
+public class TbDeclareController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbDeclareService tbDeclareService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbDeclare.PERMISSION_CODE)
+	@Transactional(rollbackFor = Exception.class)
+	public AjaxJson add(TbDeclare t){
+		tbDeclareService.add(t);
+		t = tbDeclareService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbDeclare.PERMISSION_CODE)
+	public AjaxJson delete(Long id){
+		int line = tbDeclareService.delete(id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbDeclare.PERMISSION_CODE)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+		int line = SP.publicMapper.deleteByIds(TbDeclare.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbDeclare.PERMISSION_CODE)
+	public AjaxJson update(TbDeclare t){
+		int line = tbDeclareService.update(t);
+		return AjaxJson.getByLine(line);
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+	public AjaxJson getById(Long id){
+		TbDeclare t = tbDeclareService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbDeclare> list = tbDeclareService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	
+	// ------------------------- 前端接口 -------------------------
+	
+	
+	/** 改 - 不传不改 [G] */
+	@RequestMapping("updateByNotNull")
+	public AjaxJson updateByNotNull(Long id){
+		AjaxError.throwBy(true, "如需正常调用此接口,请删除此行代码");
+		// 鉴别身份,是否为数据创建者 
+		long userId = SP.publicMapper.getColumnByIdToLong(TbDeclare.TABLE_NAME, "user_id", id);
+		AjaxError.throwBy(userId != StpUserUtil.getLoginIdAsLong(), "此数据您无权限修改");
+		// 开始修改 (请只保留需要修改的字段)
+		SoMap so = SoMap.getRequestSoMap();
+		so.clearNotIn("id", "businessId", "goodsName", "grossWeight", "num", "productionDate", "expirationDate", "storageMode", "productionMode", "origin", "producerCode", "sendUnit", "receiveUnit", "route", "driverName", "driverPhone", "agent", "agentPhone", "chinaCarNo", "carNo", "customProof", "quarantineProof", "shop", "productionCode", "containerCode").clearNull().humpToLineCase();	
+		int line = SP.publicMapper.updateBySoMapById(TbDeclare.TABLE_NAME, so, id);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+	
+	
+	
+	
+
+}

+ 56 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.java

@@ -0,0 +1,56 @@
+package com.pj.project.tb_declare;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_declare -- 
+ * @author lzm 
+ */
+
+@Mapper
+@Repository
+public interface TbDeclareMapper extends BaseMapper<TbDeclare> {
+
+	/**
+	 * 增  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int add(TbDeclare t);
+
+	/**
+	 * 删  
+	 * @param id 要删除的数据id  
+	 * @return 受影响行数 
+	 */
+	int delete(Long id);	 
+
+	/** 
+	 * 改  
+	 * @param t 实体对象 
+	 * @return 受影响行数 
+	 */
+	int update(TbDeclare t);
+
+	/** 
+	 * 查 - 根据id  
+	 * @param id 要查询的数据id 
+	 * @return 实体对象 
+	 */
+	TbDeclare getById(Long id);	 
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbDeclare> getList(SoMap so);
+
+
+}

+ 164 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareMapper.xml

@@ -0,0 +1,164 @@
+<?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_declare.TbDeclareMapper">
+
+	<!-- 增 [G] -->
+	<insert id="add">
+		insert into 
+		tb_declare (id, business_id, goods_name, gross_weight, num, production_date, expiration_date, storage_mode, production_mode, origin, producer_code, send_unit, receive_unit, route, driver_name, driver_phone, agent, agent_phone, china_car_no, car_no, custom_proof, quarantine_proof, shop, production_code, container_code) 
+		values (#{id}, #{businessId}, #{goodsName}, #{grossWeight}, #{num}, #{productionDate}, #{expirationDate}, #{storageMode}, #{productionMode}, #{origin}, #{producerCode}, #{sendUnit}, #{receiveUnit}, #{route}, #{driverName}, #{driverPhone}, #{agent}, #{agentPhone}, #{chinaCarNo}, #{carNo}, #{customProof}, #{quarantineProof}, #{shop}, #{productionCode}, #{containerCode}) 
+	</insert>
+
+	<!-- 删 -->
+	<delete id="delete">
+		delete from tb_declare 
+		where id = #{id}
+	</delete>
+
+	<!-- 改 [G] -->
+	<update id="update">
+		update tb_declare set
+		id = #{id}, 
+		business_id = #{businessId}, 
+		goods_name = #{goodsName}, 
+		gross_weight = #{grossWeight}, 
+		num = #{num}, 
+		production_date = #{productionDate}, 
+		expiration_date = #{expirationDate}, 
+		storage_mode = #{storageMode}, 
+		production_mode = #{productionMode}, 
+		origin = #{origin}, 
+		producer_code = #{producerCode}, 
+		send_unit = #{sendUnit}, 
+		receive_unit = #{receiveUnit}, 
+		route = #{route}, 
+		driver_name = #{driverName}, 
+		driver_phone = #{driverPhone}, 
+		agent = #{agent}, 
+		agent_phone = #{agentPhone}, 
+		china_car_no = #{chinaCarNo}, 
+		car_no = #{carNo}, 
+		custom_proof = #{customProof}, 
+		quarantine_proof = #{quarantineProof}, 
+		shop = #{shop}, 
+		production_code = #{productionCode}, 
+		container_code = #{containerCode}
+		where id = #{id}
+	</update>
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, business_id, goods_name, gross_weight, num, production_date, expiration_date, storage_mode, production_mode, origin, producer_code, send_unit, receive_unit, route, driver_name, driver_phone, agent, agent_phone, china_car_no, car_no, custom_proof, quarantine_proof, shop, production_code, container_code from tb_declare  -->
+	
+	<!-- 通用映射:手动模式 -->
+	<resultMap id="model" type="com.pj.project.tb_declare.TbDeclare">
+		<result property="id" column="id" />
+		<result property="businessId" column="business_id" />
+		<result property="goodsName" column="goods_name" />
+		<result property="grossWeight" column="gross_weight" />
+		<result property="num" column="num" />
+		<result property="productionDate" column="production_date" />
+		<result property="expirationDate" column="expiration_date" />
+		<result property="storageMode" column="storage_mode" />
+		<result property="productionMode" column="production_mode" />
+		<result property="origin" column="origin" />
+		<result property="producerCode" column="producer_code" />
+		<result property="sendUnit" column="send_unit" />
+		<result property="receiveUnit" column="receive_unit" />
+		<result property="route" column="route" />
+		<result property="driverName" column="driver_name" />
+		<result property="driverPhone" column="driver_phone" />
+		<result property="agent" column="agent" />
+		<result property="agentPhone" column="agent_phone" />
+		<result property="chinaCarNo" column="china_car_no" />
+		<result property="carNo" column="car_no" />
+		<result property="customProof" column="custom_proof" />
+		<result property="quarantineProof" column="quarantine_proof" />
+		<result property="shop" column="shop" />
+		<result property="productionCode" column="production_code" />
+		<result property="containerCode" column="container_code" />
+	</resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_declare 
+	</sql>
+	
+	<!-- 查 - 根据id -->
+	<select id="getById" resultMap="model">
+		<include refid="select_sql"></include>
+		where id = #{id}
+	</select>
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [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("businessId") '> and business_id = #{businessId} </if>
+			<if test=' this.has("goodsName") '> and goods_name = #{goodsName} </if>
+			<if test=' this.has("grossWeight") '> and gross_weight = #{grossWeight} </if>
+			<if test=' this.has("num") '> and num = #{num} </if>
+			<if test=' this.has("productionDate") '> and production_date = #{productionDate} </if>
+			<if test=' this.has("expirationDate") '> and expiration_date = #{expirationDate} </if>
+			<if test=' this.has("storageMode") '> and storage_mode = #{storageMode} </if>
+			<if test=' this.has("productionMode") '> and production_mode = #{productionMode} </if>
+			<if test=' this.has("origin") '> and origin = #{origin} </if>
+			<if test=' this.has("producerCode") '> and producer_code = #{producerCode} </if>
+			<if test=' this.has("sendUnit") '> and send_unit = #{sendUnit} </if>
+			<if test=' this.has("receiveUnit") '> and receive_unit = #{receiveUnit} </if>
+			<if test=' this.has("route") '> and route = #{route} </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("agent") '> and agent = #{agent} </if>
+			<if test=' this.has("agentPhone") '> and agent_phone = #{agentPhone} </if>
+			<if test=' this.has("chinaCarNo") '> and china_car_no = #{chinaCarNo} </if>
+			<if test=' this.has("carNo") '> and car_no = #{carNo} </if>
+			<if test=' this.has("customProof") '> and custom_proof = #{customProof} </if>
+			<if test=' this.has("quarantineProof") '> and quarantine_proof = #{quarantineProof} </if>
+			<if test=' this.has("shop") '> and shop = #{shop} </if>
+			<if test=' this.has("productionCode") '> and production_code = #{productionCode} </if>
+			<if test=' this.has("containerCode") '> and container_code = #{containerCode} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> business_id desc </when>
+			<when test='sortType == 3'> goods_name desc </when>
+			<when test='sortType == 4'> gross_weight desc </when>
+			<when test='sortType == 5'> num desc </when>
+			<when test='sortType == 6'> production_date desc </when>
+			<when test='sortType == 7'> expiration_date desc </when>
+			<when test='sortType == 8'> storage_mode desc </when>
+			<when test='sortType == 9'> production_mode desc </when>
+			<when test='sortType == 10'> origin desc </when>
+			<when test='sortType == 11'> producer_code desc </when>
+			<when test='sortType == 12'> send_unit desc </when>
+			<when test='sortType == 13'> receive_unit desc </when>
+			<when test='sortType == 14'> route desc </when>
+			<when test='sortType == 15'> driver_name desc </when>
+			<when test='sortType == 16'> driver_phone desc </when>
+			<when test='sortType == 17'> agent desc </when>
+			<when test='sortType == 18'> agent_phone desc </when>
+			<when test='sortType == 19'> china_car_no desc </when>
+			<when test='sortType == 20'> car_no desc </when>
+			<when test='sortType == 21'> custom_proof desc </when>
+			<when test='sortType == 22'> quarantine_proof desc </when>
+			<when test='sortType == 23'> shop desc </when>
+			<when test='sortType == 24'> production_code desc </when>
+			<when test='sortType == 25'> container_code desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 50 - 0
sp-server/src/main/java/com/pj/project/tb_declare/TbDeclareService.java

@@ -0,0 +1,50 @@
+package com.pj.project.tb_declare;
+
+import java.util.List;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.pj.utils.sg.*;
+
+/**
+ * Service: tb_declare -- 
+ * @author lzm 
+ */
+@Service
+public class TbDeclareService extends ServiceImpl<TbDeclareMapper, TbDeclare> implements IService<TbDeclare> {
+
+	/** 底层 Mapper 对象 */
+	@Autowired
+	TbDeclareMapper tbDeclareMapper;
+
+	/** 增 */
+	int add(TbDeclare t){
+		return tbDeclareMapper.add(t);
+	}
+
+	/** 删 */
+	int delete(Long id){
+		return tbDeclareMapper.delete(id);
+	}
+
+	/** 改 */
+	int update(TbDeclare t){
+		return tbDeclareMapper.update(t);
+	}
+
+	/** 查 */
+	TbDeclare getById(Long id){
+		return tbDeclareMapper.getById(id);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	List<TbDeclare> getList(SoMap so) {
+		return tbDeclareMapper.getList(so);	
+	}
+	
+
+}