update code
parent
4606c0876c
commit
5e1c11b9a4
|
@ -34,4 +34,16 @@ public class ProjectCostOutputController {
|
||||||
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
|
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
|
||||||
return AjaxResult.success(list);
|
return AjaxResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/sumByDeptId")
|
||||||
|
public AjaxResult sumByDeptId(@RequestBody SurProjectCostOutput where){
|
||||||
|
String key="bgscreen_costOut_sumByDeptId_"+where.getYear()+"-"+where.getMonth()+"-"+where.getId()+"-"+where.getProjectId();
|
||||||
|
Object obj=redisCache.getCacheObject(key);
|
||||||
|
if(obj!=null){
|
||||||
|
return AjaxResult.success(obj);
|
||||||
|
}
|
||||||
|
List<SurProjectCostOutput> list=surProjectCostOutputService.sumByDeptId(where);
|
||||||
|
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,4 +61,6 @@ public interface SurProjectCostOutputMapper
|
||||||
public int deleteSurProjectCostOutputByIds(Long[] ids);
|
public int deleteSurProjectCostOutputByIds(Long[] ids);
|
||||||
|
|
||||||
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where);
|
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where);
|
||||||
|
|
||||||
|
List<SurProjectCostOutput> sumByDeptId(SurProjectCostOutput where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,4 +71,6 @@ public interface ISurProjectCostOutputService
|
||||||
public void addMonthInvestment(SurProjectCostOutput where);
|
public void addMonthInvestment(SurProjectCostOutput where);
|
||||||
|
|
||||||
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where);
|
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where);
|
||||||
|
|
||||||
|
public List<SurProjectCostOutput> sumByDeptId(SurProjectCostOutput where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,5 +161,10 @@ public class SurProjectCostOutputServiceImpl implements ISurProjectCostOutputSer
|
||||||
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where) {
|
public List<SurProjectCostOutput> selectYearAndMonth(SurProjectCostOutput where) {
|
||||||
return surProjectCostOutputMapper.selectYearAndMonth(where);
|
return surProjectCostOutputMapper.selectYearAndMonth(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SurProjectCostOutput> sumByDeptId(SurProjectCostOutput where) {
|
||||||
|
return surProjectCostOutputMapper.sumByDeptId(where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,5 +198,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE is_del=0 AND project_id IN (
|
WHERE is_del=0 AND project_id IN (
|
||||||
SELECT id FROM sur_project WHERE isdel=0 AND projecttype=#{type})
|
SELECT id FROM sur_project WHERE isdel=0 AND projecttype=#{type})
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -109,4 +109,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
OR (cost_type = 9 AND YEAR < #{year})
|
OR (cost_type = 9 AND YEAR < #{year})
|
||||||
)
|
)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="sumByDeptId" parameterType="SurProjectCostOutput" resultMap="SurProjectCostOutputResult">
|
||||||
|
SELECT 10 cost_type , SUM(money) money FROM sur_project_cost_output
|
||||||
|
WHERE ( (cost_type=9 AND YEAR=#{year} AND MONTH <= #{month}) OR (cost_type=9 AND YEAR <#{year}))
|
||||||
|
<if test="id!=null and id>0">
|
||||||
|
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{id})
|
||||||
|
</if>
|
||||||
|
<if test="projectId!=null and projectId>0">
|
||||||
|
and project_id=#{projectId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT 2 cost_type , SUM(money) money FROM sur_project_cost_output
|
||||||
|
WHERE (cost_type=2 AND YEAR=#{year} )
|
||||||
|
<if test="id!=null and id>0">
|
||||||
|
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{id})
|
||||||
|
</if>
|
||||||
|
<if test="projectId!=null and projectId>0">
|
||||||
|
and project_id=#{projectId}
|
||||||
|
</if>
|
||||||
|
UNION
|
||||||
|
|
||||||
|
SELECT 9 cost_type , SUM(money) money FROM sur_project_cost_output
|
||||||
|
WHERE (cost_type=9 AND YEAR=#{year} AND MONTH= #{month} )
|
||||||
|
<if test="id!=null and id>0">
|
||||||
|
and project_id IN (SELECT id FROM sur_project WHERE deptid=#{id})
|
||||||
|
</if>
|
||||||
|
<if test="projectId!=null and projectId>0">
|
||||||
|
and project_id=#{projectId}
|
||||||
|
</if>
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue