<?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="org.springblade.modules.recovery.mapper.RecoveryMapper">
|
|
<!--自定义查询采收记录分页数据-->
|
<select id="selectRecoveryPage" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
|
select sr.*,sl.land_name landName,ss.strain_name strainName from sys_recovery sr
|
left join sys_land sl on sl.id = sr.land_id
|
left join sys_strain ss on ss.id = sr.strain_id
|
where 1=1
|
<if test="recovery.strainId!=null and recovery.strainId!=''">
|
and sr.strain_id = #{recovery.strainId}
|
</if>
|
<if test="recovery.leaves!=null and recovery.leaves!=''">
|
and sr.leaves = #{recovery.leaves}
|
</if>
|
<if test="recovery.landId!=null and recovery.landId!=''">
|
and sr.land_id = #{recovery.landId}
|
</if>
|
<if test="recovery.jobWay!=null and recovery.jobWay!=''">
|
and sr.job_way = #{recovery.jobWay}
|
</if>
|
<if test="recovery.operator!=null and recovery.operator!=''">
|
and sr.operator = #{recovery.operator}
|
</if>
|
<if test="recovery.deptId!=null and recovery.deptId!=''">
|
and sr.dept_id = #{recovery.deptId}
|
</if>
|
<if test="recovery.tenantId!=null and recovery.tenantId!=''">
|
and sr.tenant_id = #{recovery.tenantId}
|
</if>
|
</select>
|
|
<!--查询当前前缀已有的溯源码编号,取倒数7位的最大值-->
|
<select id="getCodePreCount" resultType="java.lang.Integer">
|
select ifnull(max(0+RIGHT(code,7)),0) from sys_traceability
|
where code like concat('%', #{pre},'%')
|
</select>
|
|
<!--查询农产品采收记录信息-->
|
<select id="getRecoveryDetail" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
|
select sr.id,sr.strain_id strainId,sr.land_id landId,sr.time,ss.strain_name strainName,ss.url,
|
case
|
when sfp.plant = '0' then '有机'
|
when sfp.plant = 1 then '绿色'
|
when sfp.plant = 2 then '无公害'
|
else '普通' end as lx
|
from sys_recovery sr
|
left join sys_strain ss on sr.strain_id = ss.id
|
left join sys_farm_plant sfp on sfp.id = sr.farm_plant_id
|
where sr.id = #{recoveryId}
|
</select>
|
</mapper>
|