| | |
| | | <result column="status" property="status"/> |
| | | <result column="is_deleted" property="isDeleted"/> |
| | | <result column="strain_id" property="strainId"/> |
| | | <result column="strain_name" property="strainName"/> |
| | | <result column="sale_time" property="saleTime"/> |
| | | <result column="sale_num" property="saleNum"/> |
| | | <result column="process_id" property="processId"/> |
| | |
| | | |
| | | |
| | | <select id="selectProcessPage" resultMap="processResultMap"> |
| | | SELECT p.strain_id, |
| | | p.land_id, |
| | | SELECT p.strain_id,p.id, |
| | | p.land_id,sale_time,sale_num,strain_name,process_id, |
| | | SUM(p.process_num) as process_num, |
| | | m.machining_type AS processName, |
| | | m.machining_tp AS tpurl |
| | | FROM sys_process p |
| | | LEFT JOIN sys_machining m ON m.id = p.process_id |
| | | LEFT JOIN sys_land sl ON sl.id = p.land_id |
| | | LEFT JOIN sys_strain strain ON p.strain_id = strain.id |
| | | WHERE p.is_deleted = 0 |
| | | <if test="process.farmId!=null and process.farmId!=''"> |
| | | and sl.farm_id = #{process.farmId} |
| | | </if> |
| | | GROUP BY p.strain_id,m.machining_type,m.machining_tp,p.land_id |
| | | <if test="process.strainId !=null and process.strainId !=''"> |
| | | and p.strain_id = #{process.strainId} |
| | | </if> |
| | | GROUP BY p.strain_id,m.machining_type,m.machining_tp,p.land_id,sale_time,sale_num,process_id,p.id ORDER BY p.create_time DESC |
| | | </select> |
| | | |
| | | <select id="stockCompare" resultType="boolean"> |
| | | SELECT |
| | | CASE |
| | | WHEN |
| | | process_num > #{saleNum} THEN |
| | | TRUE ELSE FALSE |
| | | END result |
| | | FROM |
| | | sys_process |
| | | WHERE |
| | | id = #{proid} |
| | | </select> |
| | | |
| | | <update id="stockReduce"> |
| | | UPDATE sys_process SET process_num = process_num - #{saleNum} |
| | | WHERE |
| | | id = #{proid} |
| | | </update> |
| | | </mapper> |