<?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.stockrecord.mapper.StockrecordMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="stockrecordResultMap" type="org.springblade.modules.stockrecord.entity.Stockrecord">
|
<result column="id" property="id"/>
|
<result column="stock_id1" property="stockId1"/>
|
<result column="amount1" property="amount1"/>
|
<result column="time1" property="time1"/>
|
<result column="type1" property="type1"/>
|
<result column="operator1" property="operator1"/>
|
<result column="spn1" property="spn1"/>
|
<result column="stock_type1" property="stockType1"/>
|
<result column="picture1" property="picture1"/>
|
<result column="remarks1" property="remarks1"/>
|
</resultMap>
|
|
|
<select id="selectStockrecordPage" resultMap="stockrecordResultMap">
|
select *
|
from sys_stockrecord
|
where is_deleted = 0
|
</select>
|
<select id="seletList" resultType="org.springblade.modules.stock.vo.StockVO">
|
SELECT st.*,
|
stf.type as stype,
|
stf.factory_name as factoryName,
|
d.dict_value as dic1,
|
c.dict_value as dic2
|
FROM `sys_stock` st
|
LEFT JOIN sys_stockfactory stf ON st.stock_id = stf.id
|
LEFT JOIN (SELECT dict_key,dict_value FROM blade_dict_biz WHERE `code`='stockSpecs1' AND is_deleted=0) d ON
|
d.dict_key=st.specs_value1
|
LEFT JOIN (SELECT dict_key,dict_value FROM blade_dict_biz WHERE `code`='stockSpecs2' AND is_deleted=0) c ON
|
c.dict_key=st.specs_value2
|
WHERE st.is_deleted = 0
|
<if test="stock.stype!=null and stock.stype != ''">
|
and stf.type = #{stock.stype}
|
</if>
|
<if test="stock.specsValue1!=null and stock.specsValue1 != ''">
|
and st.specs_value1 = #{stock.specsValue1}
|
</if>
|
<if test="stock.specsValue2!=null and stock.specsValue2 != ''">
|
and st.specs_value2 = #{stock.specsValue2}
|
</if>
|
<if test="stock.type!=null and stock.type!= ''">
|
and st.type = #{stock.type}
|
</if>
|
<if test="stock.state!=null and stock.state!= ''">
|
and st.state = #{stock.state}
|
</if>
|
</select>
|
|
|
<!--农资记录查询-->
|
<select id="seletStockRecordList" resultType="org.springblade.modules.stockrecord.vo.StockrecordVO">
|
SELECT st.*,
|
stf.type AS stype,
|
stf.factory_name AS factoryName,
|
d.dict_value AS dic1,
|
c.dict_value AS dic2,
|
a.name as czr
|
FROM `sys_stockrecord` st
|
LEFT JOIN sys_stockfactory stf
|
ON st.stock_id1 = stf.id
|
LEFT JOIN (SELECT dict_key, dict_value
|
FROM blade_dict_biz
|
WHERE `code` = 'stockSpecs1'
|
AND is_deleted = 0) d ON d.dict_key = st.specs_val1
|
LEFT JOIN (SELECT dict_key, dict_value
|
FROM blade_dict_biz
|
WHERE `code` = 'stockSpecs2'
|
AND is_deleted = 0) c ON c.dict_key = st.specs_val2
|
LEFT JOIN (SELECT name, id FROM blade_user WHERE is_deleted = 0) a ON a.id = st.create_user
|
WHERE st.is_deleted = 0
|
</select>
|
</mapper>
|