| | |
| | | LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_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 |
| | | WHERE CODE = 'stockSpecs1' AND is_deleted = 0 |
| | | <if test="stock.codes!=null and stock.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{stock.codes} |
| | | </if>) 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 |
| | | LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 ) a ON |
| | | WHERE CODE = 'stockSpecs2' AND is_deleted = 0 <if test="stock.codes!=null and stock.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{stock.codes} |
| | | </if>) c ON c.dict_key = st.specs_value2 |
| | | LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 |
| | | <if test="stock.codes!=null and stock.codes != ''"> |
| | | AND blade_dict_biz.tenant_id = #{stock.codes} |
| | | </if>) a ON |
| | | a.dict_key = stf.type |
| | | WHERE st.is_deleted = 0 and state=0 |
| | | <if test="stock.stype!=null and stock.stype != ''"> |
| | |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 0 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime} |
| | | </if> |
| | | <if test="stock.deptId!=null and stock.deptId!=''"> |
| | | and dept_id = #{stock.deptId} |
| | | </if> |
| | | GROUP BY stock_id1) cg ON cg.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbrknum |
| | |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 1 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime} |
| | | </if> |
| | | <if test="stock.deptId!=null and stock.deptId!=''"> |
| | | and dept_id = #{stock.deptId} |
| | | </if> |
| | | GROUP BY stock_id1) dbr ON dbr.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS lycknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 0 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime} |
| | | </if> |
| | | <if test="stock.deptId!=null and stock.deptId!=''"> |
| | | and dept_id = #{stock.deptId} |
| | | </if> |
| | | GROUP BY stock_id1) lyc ON lyc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbcknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 1 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime} |
| | | </if> |
| | | <if test="stock.deptId!=null and stock.deptId!=''"> |
| | | and dept_id = #{stock.deptId} |
| | | </if> |
| | | GROUP BY stock_id1) dbc ON dbc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS bfcknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 2 |
| | | <if test="stock.startTime!=null and stock.startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime} |
| | | </if> |
| | | <if test="stock.endTime!=null and stock.endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime} |
| | | </if> |
| | | <if test="stock.deptId!=null and stock.deptId!=''"> |
| | | and dept_id = #{stock.deptId} |
| | | </if> |
| | | GROUP BY stock_id1) bfc ON bfc.stock_id1 = a.id |
| | | </select> |
| | |
| | | FROM `sys_stock` st |
| | | LEFT JOIN (SELECT id, type FROM sys_stockfactory) sto ON st.stock_id = sto.id |
| | | WHERE st.is_deleted = 0 |
| | | and dept_id = #{deptId} |
| | | </select> |
| | | |
| | | <!--小程序数据统计--> |
| | |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 0 |
| | | <if test="startTime!=null and startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime} |
| | | </if> |
| | | <if test="endTime!=null and endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime} |
| | | </if> |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and dept_id = #{deptId} |
| | | </if> |
| | | GROUP BY stock_id1) cg ON cg.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbrknum |
| | |
| | | WHERE stock_type1 = 1 |
| | | AND type1 = 1 |
| | | <if test="startTime!=null and startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime} |
| | | </if> |
| | | <if test="endTime!=null and endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime} |
| | | </if> |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and dept_id = #{deptId} |
| | | </if> |
| | | GROUP BY stock_id1) dbr ON dbr.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS lycknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 0 |
| | | <if test="startTime!=null and startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime} |
| | | </if> |
| | | <if test="endTime!=null and endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime} |
| | | </if> |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and dept_id = #{deptId} |
| | | </if> |
| | | GROUP BY stock_id1) lyc ON lyc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS dbcknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 1 |
| | | <if test="startTime!=null and startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime} |
| | | </if> |
| | | <if test="endTime!=null and endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime} |
| | | </if> |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and dept_id = #{deptId} |
| | | </if> |
| | | GROUP BY stock_id1) dbc ON dbc.stock_id1 = a.id |
| | | LEFT JOIN (SELECT stock_id1, SUM(census) AS bfcknum |
| | |
| | | WHERE stock_type1 = 0 |
| | | AND type1 = 2 |
| | | <if test="startTime!=null and startTime!=''"> |
| | | and time1 >= #{stock.startTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime} |
| | | </if> |
| | | <if test="endTime!=null and endTime!=''"> |
| | | and time1 <= #{stock.endTime} |
| | | and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime} |
| | | </if> |
| | | <if test="deptId!=null and deptId!=''"> |
| | | and dept_id = #{deptId} |
| | | </if> |
| | | GROUP BY stock_id1) bfc ON bfc.stock_id1 = a.id |
| | | </select> |