| | |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.system.model.AssetType"> |
| | | <id column="id" property="id" /> |
| | | <result column="type_name" property="typeName" /> |
| | | <result column="type_code" property="typeCode" /> |
| | | <result column="parent_id" property="parentId" /> |
| | | <result column="level" property="level" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="disabled" property="disabled" /> |
| | | <id column="id" property="id"/> |
| | | <result column="type_name" property="typeName"/> |
| | | <result column="type_code" property="typeCode"/> |
| | | <result column="parent_id" property="parentId"/> |
| | | <result column="level" property="level"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="create_by" property="createBy"/> |
| | | <result column="update_time" property="updateTime"/> |
| | | <result column="update_by" property="updateBy"/> |
| | | <result column="disabled" property="disabled"/> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, type_name, type_code, parent_id, level, create_time, create_by, update_time, update_by, disabled |
| | | id |
| | | , type_name, type_code, parent_id, level, create_time, create_by, update_time, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.AssetStatisticsVO"> |
| | | select t1.id as assetTypeIdSecond,t1.type_name as assetTypeNameSecond, |
| | | t2.id as assetTypeIdFirst,t2.type_name as assetTypeNameFirst |
| | | t2.id as assetTypeIdFirst,t2.type_name as assetTypeNameFirst |
| | | FROM asset_type t1 |
| | | left join asset_type t2 on t1.parent_id = t2.id |
| | | where 1=1 |
| | | and |
| | | t1.parent_id != 0 |
| | | <if test="query.assetTypeIds != null and query.assetTypeIds.size()>0"> |
| | | <if test="query.assetMainIds != null and query.assetMainIds.size()>0"> |
| | | AND t1.id IN |
| | | <foreach collection="query.assetMainIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.assetTypeIds != null and query.assetTypeIds.size()>0"> |
| | | AND t1.asset_type_id IN |
| | | <foreach collection="query.assetTypeIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | |
| | | </select> |
| | | <select id="pageListNoLimit" resultType="com.ruoyi.system.vo.AssetStatisticsVO"> |
| | |
| | | AND t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </select> |
| | | <select id="pageListDetail" resultType="com.ruoyi.system.vo.AssetStatisticsDetailVO"> |
| | | select t1.* ,t2.type_name as assetTypeName,t4.dept_name as ownershipDeptName, |
| | | select t1.* ,t2.type_name as assetTypeName,t4.dept_name as ownershipDeptName, |
| | | case |
| | | when t1.use_dept_id is not null and t1.use_dept_id != '' then t3.dept_name |
| | | when t1.address is not null and t1.address != '' then t1.address |
| | | when t1.warehouse_name is not null and t1.warehouse_name != '' then t1.warehouse_name |
| | | else null |
| | | end as useName from asset_main |
| | | end as useName from asset_main t1 |
| | | left join asset_type t2 on t2.id = t1.asset_type_id |
| | | left join t_dept t3 on t3.id = t1.use_dept_id |
| | | left join t_dept t4 on t4.id = t1.ownership_dept_id |
| | | |
| | | where 1=1 |
| | | <if test="query.assetTypeIdSecond != null"> |
| | | AND t1.asset_type_id = #{query.assetTypeIdSecond} |
| | | <if test="query.category != null"> |
| | | AND t1.category = #{query.category} |
| | | </if> |
| | | <if test="query.deptId != null"> |
| | | AND t1.asset_type_id = #{query.assetTypeIdSecond} |
| | | </if> |
| | | AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | <if test="query.assetMainIds != null and query.assetMainIds.size()>0"> |
| | | AND t1.id IN |
| | | <foreach collection="query.assetMainIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.deptIds != null and query.deptIds.size()>0"> |
| | | AND t1.ownership_dept_id IN |
| | | <foreach collection="query.deptIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | order by t1.create_time desc |
| | | order by t1.create_time desc |
| | | |
| | | </select> |
| | | <select id="pageListInventory" resultType="com.ruoyi.system.vo.AssetInventoryVO"> |
| | | select t1.name as assetTypeNameSecond,t1.id as assetTypeIdSecond, |
| | | t2.name as assetTypeNameFirst,t2.id as assetTypeIdFirst |
| | | from asset_type t1 |
| | | left join asset_type t2 on t1.parent_id = t2.id |
| | | where t1.parent_id != 0 |
| | | <if test="query.assetTypeIds != null and query.assetTypeIds.size()>0"> |
| | | AND t1.id IN |
| | | <foreach collection="query.assetTypeIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | and t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | and t2.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} |
| | | </select> |
| | | <select id="pageListInventoryDetail" resultType="com.ruoyi.system.vo.AssetStatisticsDetailVO"> |
| | | select t1.*,t2.*,case |
| | | when t1.use_dept_id is not null and t1.use_dept_id != '' then t3.dept_name |
| | | when t1.address is not null and t1.address != '' then t1.address |
| | | when t1.warehouse_name is not null and t1.warehouse_name != '' then t1.warehouse_name |
| | | else null |
| | | end as useName, |
| | | |
| | | from asset_inventory_record t1 |
| | | left join asset_main t2 on t1.asset_main_id = t2.id |
| | | left join t_dept t3 on t3.id = t1.use_dept_id |
| | | left join t_dept t4 on t4.id = t1.ownership_dept_id |
| | | where 1=1 |
| | | <if test="query.category != null and query.category!=''"> |
| | | AND t2.category = #{query.category} |
| | | </if> |
| | | |
| | | <if test="query.assetStatus != null and query.assetStatus!=''"> |
| | | and t2.asset_status like concat('%',#{query.assetStatus},'%') |
| | | </if> |
| | | <if test="query.deptIds != null and query.deptIds.size()>0"> |
| | | AND t2.ownership_dept_id IN |
| | | <foreach collection="query.deptIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="query.assetMainIds != null and query.assetMainIds.size()>0"> |
| | | AND t2.id IN |
| | | <foreach collection="query.assetMainIds" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | order by t1.create_time desc |
| | | |
| | | </select> |
| | | |