feat:查询资产类型分布接口开发

This commit is contained in:
lvjiahao 2024-09-03 09:39:13 +08:00
parent c1de314170
commit ed18b3f855
6 changed files with 80 additions and 8 deletions

View File

@ -5,14 +5,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.god.common.annotation.Log; import com.god.common.annotation.Log;
import com.god.common.core.controller.BaseController; import com.god.common.core.controller.BaseController;
import com.god.common.core.domain.AjaxResult; import com.god.common.core.domain.AjaxResult;
@ -101,4 +94,15 @@ public class NetAssetManagementController extends BaseController
{ {
return toAjax(netAssetManagementService.deleteNetAssetManagementByIds(ids)); return toAjax(netAssetManagementService.deleteNetAssetManagementByIds(ids));
} }
/**
* 查询资产管理资产类型分布
*
* @return 资产类型数量
*/
@GetMapping( "/type-total")
public AjaxResult selectNetAssetManagementTotalByType()
{
return success(netAssetManagementService.selectNetAssetManagementTotalByType());
}
} }

View File

@ -0,0 +1,30 @@
package com.god.wlsbInformation.domain;
/**
* 资产管理资产类型分别对象 net_asset_management_vto
*
* @author lvjiahao
* @date 2024-09-02
*/
public class NetAssetManagementVTO {
private String assetType;
private int assetTotal;
public String getAssetType() {
return assetType;
}
public void setAssetType(String assetType) {
this.assetType = assetType;
}
public int getAssetTotal() {
return assetTotal;
}
public void setAssetTotal(int assetTotal) {
this.assetTotal = assetTotal;
}
}

View File

@ -2,6 +2,7 @@ package com.god.wlsbInformation.mapper;
import java.util.List; import java.util.List;
import com.god.wlsbInformation.domain.NetAssetManagement; import com.god.wlsbInformation.domain.NetAssetManagement;
import com.god.wlsbInformation.domain.NetAssetManagementVTO;
/** /**
* 资产管理Mapper接口 * 资产管理Mapper接口
@ -58,4 +59,11 @@ public interface NetAssetManagementMapper
* @return 结果 * @return 结果
*/ */
public int deleteNetAssetManagementByIds(String[] ids); public int deleteNetAssetManagementByIds(String[] ids);
/**
* 查询资产管理资产类型分布
*
* @return 资产类型数量
*/
public List<NetAssetManagementVTO> selectNetAssetManagementTotalByType();
} }

View File

@ -2,6 +2,7 @@ package com.god.wlsbInformation.service;
import java.util.List; import java.util.List;
import com.god.wlsbInformation.domain.NetAssetManagement; import com.god.wlsbInformation.domain.NetAssetManagement;
import com.god.wlsbInformation.domain.NetAssetManagementVTO;
/** /**
* 资产管理Service接口 * 资产管理Service接口
@ -58,4 +59,11 @@ public interface INetAssetManagementService
* @return 结果 * @return 结果
*/ */
public int deleteNetAssetManagementById(String id); public int deleteNetAssetManagementById(String id);
/**
* 查询资产管理资产类型分布
*
* @return 资产类型数量
*/
public List<NetAssetManagementVTO> selectNetAssetManagementTotalByType();
} }

View File

@ -3,6 +3,7 @@ package com.god.wlsbInformation.service.impl;
import java.util.List; import java.util.List;
import com.god.common.utils.uuid.IdUtils; import com.god.common.utils.uuid.IdUtils;
import com.god.wlsbInformation.domain.NetAssetManagementVTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.god.wlsbInformation.mapper.NetAssetManagementMapper; import com.god.wlsbInformation.mapper.NetAssetManagementMapper;
@ -93,4 +94,14 @@ public class NetAssetManagementServiceImpl implements INetAssetManagementService
{ {
return netAssetManagementMapper.deleteNetAssetManagementById(id); return netAssetManagementMapper.deleteNetAssetManagementById(id);
} }
/**
* 查询资产管理资产类型分布
*
* @return 资产类型数量
*/
@Override
public List<NetAssetManagementVTO> selectNetAssetManagementTotalByType(){
return netAssetManagementMapper.selectNetAssetManagementTotalByType();
}
} }

View File

@ -21,6 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="assetRemark" column="asset_remark" /> <result property="assetRemark" column="asset_remark" />
</resultMap> </resultMap>
<resultMap type="NetAssetManagementVTO" id="NetAssetManagementVTOResult">
<result property="assetType" column="asset_type" />
<result property="assetTotal" column="asset_total" />
</resultMap>
<sql id="selectNetAssetManagementVo"> <sql id="selectNetAssetManagementVo">
select id, asset_id, asset_name, asset_status, asset_model, asset_type, asset_unit, asset_number, asset_value, asset_department, asset_time, asset_total, asset_save, asset_remark from net_asset_management select id, asset_id, asset_name, asset_status, asset_model, asset_type, asset_unit, asset_number, asset_value, asset_department, asset_time, asset_total, asset_save, asset_remark from net_asset_management
</sql> </sql>
@ -111,4 +116,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectNetAssetManagementTotalByType" resultMap="NetAssetManagementVTOResult">
select sum(asset_total) asset_total,asset_type
from net_asset_management
group by asset_type
</select>
</mapper> </mapper>