|
|
@@ -17,7 +17,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="farmIntro" column="farm_intro" />
|
|
|
<result property="produceDate" column="produce_date" />
|
|
|
<result property="packageDate" column="package_date" />
|
|
|
+ <result property="startPlantingTime" column="start_planting_time" />
|
|
|
<result property="status" column="status" />
|
|
|
+ <result property="farmId" column="farm_id" />
|
|
|
+ <result property="fieldId" column="field_id" />
|
|
|
<result property="createdAt" column="created_at" />
|
|
|
<result property="updatedAt" column="updated_at" />
|
|
|
<association property="certificate" javaType="Certificate" select="com.ruoyi.base.mapper.CertificateMapper.selectCertificateByBatchId" column="id"/>
|
|
|
@@ -26,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectBatchVo">
|
|
|
- select id, batch_no, product_name, product_spec, product_image, product_desc, farm_name, farm_region, farm_image, farm_intro, produce_date, package_date, status, created_at, updated_at from batch
|
|
|
+ select id, batch_no, product_name, product_spec, product_image, product_desc, farm_name, farm_region, farm_image, farm_intro, produce_date, package_date,start_planting_time, status, created_at, updated_at from batch
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectBatchList" parameterType="Batch" resultMap="BatchResult">
|
|
|
@@ -55,13 +58,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</select>
|
|
|
|
|
|
<select id="selectBatchById" parameterType="Long" resultMap="BatchResult">
|
|
|
- <include refid="selectBatchVo"/>
|
|
|
+ select id, batch_no, product_name, product_spec, product_image, product_desc, farm_id, field_id,
|
|
|
+ farm_name, farm_region, farm_image, farm_intro, produce_date, package_date,start_planting_time, status, created_at, updated_at from batch
|
|
|
+
|
|
|
where id = #{id}
|
|
|
</select>
|
|
|
<select id="selectBatchByBatchNo" parameterType="String" resultMap="BatchResult">
|
|
|
<include refid="selectBatchVo"/>
|
|
|
where batch_no = #{batchNo}
|
|
|
</select>
|
|
|
+ <select id="selectLastBatchNoByDate" parameterType="String" resultType="String">
|
|
|
+ SELECT batch_no FROM batch
|
|
|
+ WHERE DATE(created_at) = #{date}
|
|
|
+ AND batch_no REGEXP '^JYHY-[0-9]{8}-[0-9]{3}$'
|
|
|
+ ORDER BY batch_no DESC
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
|
|
|
<insert id="insertBatch" parameterType="Batch" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into batch
|
|
|
@@ -71,12 +83,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="productSpec != null">product_spec,</if>
|
|
|
<if test="productImage != null">product_image,</if>
|
|
|
<if test="productDesc != null">product_desc,</if>
|
|
|
+ <if test="farmId != null and farmId != ''">farm_id,</if>
|
|
|
+ <if test="fieldId != null and fieldId != ''">field_id,</if>
|
|
|
<if test="farmName != null and farmName != ''">farm_name,</if>
|
|
|
<if test="farmRegion != null and farmRegion != ''">farm_region,</if>
|
|
|
<if test="farmImage != null">farm_image,</if>
|
|
|
<if test="farmIntro != null">farm_intro,</if>
|
|
|
<if test="produceDate != null">produce_date,</if>
|
|
|
<if test="packageDate != null">package_date,</if>
|
|
|
+ <if test="startPlantingTime != null">start_planting_time,</if>
|
|
|
<if test="status != null and status != ''">status,</if>
|
|
|
<if test="createdAt != null">created_at,</if>
|
|
|
<if test="updatedAt != null">updated_at,</if>
|
|
|
@@ -87,12 +102,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="productSpec != null">#{productSpec},</if>
|
|
|
<if test="productImage != null">#{productImage},</if>
|
|
|
<if test="productDesc != null">#{productDesc},</if>
|
|
|
+ <if test="farmId != null and farmId != ''">#{farmId},</if>
|
|
|
+ <if test="fieldId != null and fieldId != ''">#{fieldId},</if>
|
|
|
<if test="farmName != null and farmName != ''">#{farmName},</if>
|
|
|
<if test="farmRegion != null and farmRegion != ''">#{farmRegion},</if>
|
|
|
<if test="farmImage != null">#{farmImage},</if>
|
|
|
<if test="farmIntro != null">#{farmIntro},</if>
|
|
|
<if test="produceDate != null">#{produceDate},</if>
|
|
|
<if test="packageDate != null">#{packageDate},</if>
|
|
|
+ <if test="startPlantingTime != null">#{startPlantingTime},</if>
|
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
|
<if test="createdAt != null">#{createdAt},</if>
|
|
|
<if test="updatedAt != null">#{updatedAt},</if>
|
|
|
@@ -107,12 +125,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="productSpec != null">product_spec = #{productSpec},</if>
|
|
|
<if test="productImage != null">product_image = #{productImage},</if>
|
|
|
<if test="productDesc != null">product_desc = #{productDesc},</if>
|
|
|
+ <if test="farmId != null and farmId != ''">farm_id = #{farmId},</if>
|
|
|
+ <if test="fieldId != null and fieldId != ''">field_id = #{fieldId},</if>
|
|
|
<if test="farmName != null and farmName != ''">farm_name = #{farmName},</if>
|
|
|
<if test="farmRegion != null and farmRegion != ''">farm_region = #{farmRegion},</if>
|
|
|
<if test="farmImage != null">farm_image = #{farmImage},</if>
|
|
|
<if test="farmIntro != null">farm_intro = #{farmIntro},</if>
|
|
|
<if test="produceDate != null">produce_date = #{produceDate},</if>
|
|
|
<if test="packageDate != null">package_date = #{packageDate},</if>
|
|
|
+ <if test="startPlantingTime != null">start_planting_time = #{startPlantingTime},</if>
|
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
|
<if test="createdAt != null">created_at = #{createdAt},</if>
|
|
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|