| | |
| | | id, user_id, dept_id, task_name, execute_date, status, remarks, create_time, create_by, update_time, update_by, disabled |
| | | </sql> |
| | | |
| | | <!-- 获取盘点任务详情中的资产列表 --> |
| | | <select id="getAssetMainInventoryList" resultType="com.ruoyi.system.vo.asset.AssetMainInventoryVO"> |
| | | SELECT |
| | | am.id, |
| | | am.asset_code, |
| | | am.asset_name, |
| | | at2.type_name AS asset_type_name, |
| | | at1.type_name AS parent_asset_type, |
| | | am.specification_model, |
| | | am.category, |
| | | am.measurement_unit, |
| | | am.quantity, |
| | | am.unit_price, |
| | | ( am.quantity * am.unit_price ) AS total_value, |
| | | am.accounting_voucher_no, |
| | | am.accounting_subject, |
| | | am.accounting_status, |
| | | am.accounting_amount, |
| | | am.accounting_date, |
| | | am.asset_status, |
| | | od.dept_name AS ownership_dept_name, |
| | | am.ownership_dept_id, |
| | | am.asset_type_id, |
| | | am.address_type, |
| | | am.use_dept_id, |
| | | am.warehouse_id, |
| | | od2.dept_name AS use_dept_name, |
| | | su.nick_name AS user_name, |
| | | aiti.result_status AS inventory_status, |
| | | aiti.real_dept_name, |
| | | aiti.real_user_name |
| | | FROM |
| | | asset_inventory_task_item aiti |
| | | INNER JOIN |
| | | asset_main am ON aiti.asset_main_id = am.id |
| | | LEFT JOIN |
| | | asset_type at2 ON am.asset_type_id = at.id |
| | | LEFT JOIN |
| | | asset_type at1 ON at1.id = (CASE WHEN at2.level = 2 THEN at2.parent_id ELSE at2.id END) |
| | | LEFT JOIN |
| | | sys_dept od ON am.ownership_dept_id = od.dept_id |
| | | LEFT JOIN |
| | | sys_user su ON aiti.user_id = su.user_id |
| | | LEFT JOIN sys_dept od2 ON am.address_type = 0 AND am.use_dept_id = od2.id |
| | | WHERE |
| | | aiti.inventory_task_id = #{taskId} |
| | | ORDER BY |
| | | am.asset_code |
| | | </select> |
| | | |
| | | <!-- 获取盘点任务中的所有盘点人姓名(去重) --> |
| | | <select id="getInventoryUserNames" resultType="java.lang.String"> |
| | | SELECT DISTINCT su.nick_name |
| | | FROM |
| | | asset_inventory_task_item aiti |
| | | INNER JOIN |
| | | sys_user su ON aiti.user_id = su.user_id |
| | | WHERE |
| | | aiti.inventory_task_id = #{taskId} |
| | | AND su.nick_name IS NOT NULL |
| | | AND su.nick_name != '' |
| | | ORDER BY |
| | | su.nick_name |
| | | </select> |
| | | <select id="getAssetMainInventoryPageList" resultType="com.ruoyi.system.vo.asset.AssetMainInventoryVO"> |
| | | |
| | | SELECT |
| | | am.id, |
| | | am.asset_code, |
| | | am.asset_name, |
| | | at.type_name AS asset_type_name, |
| | | am.specification_model, |
| | | am.category, |
| | | am.measurement_unit, |
| | | am.quantity, |
| | | am.unit_price, |
| | | ( am.quantity * am.unit_price ) AS total_value, |
| | | am.accounting_voucher_no, |
| | | am.accounting_subject, |
| | | am.accounting_status, |
| | | am.accounting_amount, |
| | | am.accounting_date, |
| | | am.asset_status, |
| | | od.dept_name AS ownership_dept_name, |
| | | am.ownership_dept_id, |
| | | am.asset_type_id, |
| | | am.address_type, |
| | | am.use_dept_id, |
| | | am.warehouse_id, |
| | | od2.dept_name AS use_dept_name, |
| | | su.nick_name AS user_name, |
| | | aiti.result_status AS inventory_status, |
| | | aiti.real_dept_name, |
| | | aiti.real_user_name |
| | | FROM |
| | | asset_inventory_task_item aiti |
| | | INNER JOIN |
| | | asset_main am ON aiti.asset_main_id = am.id |
| | | LEFT JOIN |
| | | asset_type at ON am.asset_type_id = at.id |
| | | LEFT JOIN |
| | | sys_dept od ON am.ownership_dept_id = od.dept_id |
| | | LEFT JOIN |
| | | sys_user su ON aiti.user_id = su.user_id |
| | | LEFT JOIN sys_dept od2 ON am.address_type = 0 AND am.use_dept_id = od2.id |
| | | <where> |
| | | aiti.inventory_task_id = #{query.id} |
| | | <if test="query.keyword != null and query.keyword != ''"> |
| | | AND (am.asset_name LIKE CONCAT('%',#{query.keyword},'%') OR |
| | | am.asset_code LIKE CONCAT('%',#{query.keyword},'%')) |
| | | </if> |
| | | <if test="query.resultStatus != null"> |
| | | AND aiti.result_status = #{query.reslutStatus} |
| | | </if> |
| | | </where> |
| | | ORDER BY |
| | | am.asset_code |
| | | </select> |
| | | |
| | | <!-- 获取盘点任务统计数据 --> |
| | | <select id="getInventoryTaskStatistics" resultType="com.ruoyi.system.vo.asset.InventoryTaskStatisticsVO"> |
| | | SELECT |
| | | COALESCE(SUM(CASE WHEN result_status = 0 THEN 1 ELSE 0 END), 0) as pendingCount, |
| | | COALESCE(SUM(CASE WHEN result_status = 1 THEN 1 ELSE 0 END), 0) as normalCount, |
| | | COALESCE(SUM(CASE WHEN result_status = 2 THEN 1 ELSE 0 END), 0) as abnormalCount, |
| | | COALESCE(COUNT(*), 0) as totalCount |
| | | FROM |
| | | asset_inventory_task_item |
| | | WHERE |
| | | inventory_task_id = #{taskId} |
| | | </select> |
| | | |
| | | </mapper> |