update code
parent
1b0eb695d9
commit
96163b4c9e
|
@ -1,7 +1,9 @@
|
||||||
package com.yanzhu.jh.bigscreen.web.controller;
|
package com.yanzhu.jh.bigscreen.web.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
import com.yanzhu.jh.project.domain.SurProjectMaterialSeal;
|
import com.yanzhu.jh.project.domain.SurProjectMaterialSeal;
|
||||||
import com.yanzhu.jh.project.service.ISurProjectMaterialSealService;
|
import com.yanzhu.jh.project.service.ISurProjectMaterialSealService;
|
||||||
|
@ -16,7 +18,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bgscreen/materialSeal")
|
@RequestMapping("/bgscreen/materialSeal")
|
||||||
public class ProjectMaterialSealController {
|
public class ProjectMaterialSealController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
ISurProjectMaterialSealService materialSealService;
|
ISurProjectMaterialSealService materialSealService;
|
||||||
|
@ -27,7 +29,7 @@ public class ProjectMaterialSealController {
|
||||||
|
|
||||||
@PostMapping("/selectTop20")
|
@PostMapping("/selectTop20")
|
||||||
public AjaxResult selectTop20(@RequestBody SurProjectMaterialSeal where){
|
public AjaxResult selectTop20(@RequestBody SurProjectMaterialSeal where){
|
||||||
String key="bgscreen_selectTop20_selectTop20_"+where.getDeptId()+"-"+where.getProjectId();
|
String key="bgscreen_materialSeal_selectTop20_"+where.getDeptId()+"-"+where.getProjectId();
|
||||||
Object obj=redisCache.getCacheObject(key);
|
Object obj=redisCache.getCacheObject(key);
|
||||||
if(obj!=null){
|
if(obj!=null){
|
||||||
return AjaxResult.success(obj);
|
return AjaxResult.success(obj);
|
||||||
|
@ -36,4 +38,22 @@ public class ProjectMaterialSealController {
|
||||||
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("/groupTop12Month")
|
||||||
|
public AjaxResult groupTop12Month(@RequestBody SurProjectMaterialSeal where){
|
||||||
|
String key="bgscreen_materialSeal_groupTop12Month_"+where.getDeptId()+"-"+where.getProjectId();
|
||||||
|
Object obj=redisCache.getCacheObject(key);
|
||||||
|
if(obj!=null){
|
||||||
|
return AjaxResult.success(obj);
|
||||||
|
}
|
||||||
|
List<SurProjectMaterialSeal> list=materialSealService.groupTop12Month(where);
|
||||||
|
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
|
||||||
|
return AjaxResult.success(list);
|
||||||
|
}
|
||||||
|
@PostMapping("/selectTop12Month")
|
||||||
|
public TableDataInfo selectTop12Month(@RequestBody SurProjectMaterialSeal where){
|
||||||
|
startPage();
|
||||||
|
List<SurProjectMaterialSeal> list=materialSealService.selectTop12Month(where);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,4 +70,8 @@ public interface SurProjectMaterialSealMapper
|
||||||
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
|
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
|
||||||
|
|
||||||
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
|
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
|
||||||
|
|
||||||
|
public List<SurProjectMaterialSeal> groupTop12Month(SurProjectMaterialSeal where);
|
||||||
|
|
||||||
|
public List<SurProjectMaterialSeal> selectTop12Month(SurProjectMaterialSeal where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,4 +78,8 @@ public interface ISurProjectMaterialSealService
|
||||||
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
|
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
|
||||||
|
|
||||||
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
|
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
|
||||||
|
|
||||||
|
public List<SurProjectMaterialSeal> groupTop12Month(SurProjectMaterialSeal where);
|
||||||
|
|
||||||
|
public List<SurProjectMaterialSeal> selectTop12Month(SurProjectMaterialSeal where);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,4 +193,14 @@ public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSea
|
||||||
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where) {
|
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where) {
|
||||||
return surProjectMaterialSealMapper.selectTop20(where);
|
return surProjectMaterialSealMapper.selectTop20(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SurProjectMaterialSeal> groupTop12Month(SurProjectMaterialSeal where) {
|
||||||
|
return surProjectMaterialSealMapper.groupTop12Month(where);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SurProjectMaterialSeal> selectTop12Month(SurProjectMaterialSeal where) {
|
||||||
|
return surProjectMaterialSealMapper.selectTop12Month(where);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectSurProjectMaterialSealVo">
|
<sql id="selectSurProjectMaterialSealVo">
|
||||||
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand, spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time, spme.remark, spme.witness_user, spme.witness_user_name, spme.approve_status, spme.material_result, sp.projectName, sd.dept_name from sur_project_material_seal spme
|
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand,
|
||||||
|
spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time,
|
||||||
|
spme.remark, spme.witness_user, spme.witness_user_name, spme.approve_status, spme.material_result, sp.projectName, sd.dept_name
|
||||||
|
from sur_project_material_seal spme
|
||||||
left join sur_project sp on spme.project_id = sp.id
|
left join sur_project sp on spme.project_id = sp.id
|
||||||
left join sys_dept sd on sd.dept_id = spme.dept_id
|
left join sys_dept sd on sd.dept_id = spme.dept_id
|
||||||
</sql>
|
</sql>
|
||||||
|
@ -180,7 +183,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
<select id="selectTop20" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
|
<select id="selectTop20" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
|
||||||
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand, spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time, spme.remark, spme.projectName, spme.dept_name
|
select spme.id, spme.project_id, spme.dept_id, spme.main_image, spme.image_urls, spme.material_name, spme.use_position, spme.contract_brand, spme.use_brand, spme.seal_date, spme.sign_files, spme.alteration_files, spme.is_del, spme.create_by, spme.create_time, spme.update_by, spme.update_time, spme.remark, spme.projectName,
|
||||||
|
spme.dept_name
|
||||||
from (
|
from (
|
||||||
select spme.*,sp.projectName, sd.dept_name from sur_project_material_seal spme
|
select spme.*,sp.projectName, sd.dept_name from sur_project_material_seal spme
|
||||||
left join sur_project sp on spme.project_id = sp.id
|
left join sur_project sp on spme.project_id = sp.id
|
||||||
|
@ -192,4 +196,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
order by spme.create_time desc
|
order by spme.create_time desc
|
||||||
LIMIT 0,20
|
LIMIT 0,20
|
||||||
</select>
|
</select>
|
||||||
|
<select id="groupTop12Month" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
|
||||||
|
select year(seal_date) project_id,month(seal_date) dept_id,count(1) id
|
||||||
|
|
||||||
|
from sur_project_material_seal where is_del=0
|
||||||
|
<if test="deptId != null and deptId > 0"> and project_id in ( SELECT id FROM sur_project WHERE deptid= #{deptId}) </if>
|
||||||
|
<if test="projectId != null and projectId > 0">and project_id = #{projectId}</if>
|
||||||
|
and seal_date>=DATE_SUB(CURDATE(),interval 12 month)
|
||||||
|
group by year(seal_date),month(seal_date)
|
||||||
|
order by year(seal_date) desc,month(seal_date) desc
|
||||||
|
</select>
|
||||||
|
<select id="selectTop12Month" parameterType="SurProjectMaterialSeal" resultMap="SurProjectMaterialSealResult">
|
||||||
|
select *
|
||||||
|
from (
|
||||||
|
select spme.*,sp.projectName, sd.dept_name from sur_project_material_seal spme
|
||||||
|
left join sur_project sp on spme.project_id = sp.id
|
||||||
|
left join sys_dept sd on sd.dept_id = spme.dept_id
|
||||||
|
where spme.is_del=0
|
||||||
|
and spme.seal_date>=DATE_SUB(CURDATE(),interval 12 month)
|
||||||
|
<if test="deptId != null and deptId > 0"> and sp.deptId = #{deptId} </if>
|
||||||
|
<if test="projectId != null and projectId > 0">and sp.id = #{projectId}</if>
|
||||||
|
order by spme.seal_date desc
|
||||||
|
) spme
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue