dev_xds
姜玉琦 2023-08-27 13:19:00 +08:00
commit df83d6f43b
5 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,39 @@
package com.yanzhu.jh.bigscreen.web.controller;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import com.yanzhu.jh.project.domain.SurProjectMaterialSeal;
import com.yanzhu.jh.project.service.ISurProjectMaterialSealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping("/bgscreen/materialSeal")
public class ProjectMaterialSealController {
@Autowired
ISurProjectMaterialSealService materialSealService;
@Autowired
private RedisCache redisCache;
@PostMapping("/selectTop20")
public AjaxResult selectTop20(@RequestBody SurProjectMaterialSeal where){
String key="bgscreen_selectTop20_selectTop20_"+where.getDeptId()+"-"+where.getProjectId();
Object obj=redisCache.getCacheObject(key);
if(obj!=null){
return AjaxResult.success(obj);
}
List<SurProjectMaterialSeal> list=materialSealService.selectTop20(where);
redisCache.setCacheObject(key, list, Constants.BIGSCREEN_QUERY_CACHE, TimeUnit.MINUTES);
return AjaxResult.success(list);
}
}

View File

@ -58,4 +58,6 @@ public interface SurProjectMaterialSealMapper
* @return * @return
*/ */
public int deleteSurProjectMaterialSealByIds(Long[] ids); public int deleteSurProjectMaterialSealByIds(Long[] ids);
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
} }

View File

@ -58,4 +58,6 @@ public interface ISurProjectMaterialSealService
* @return * @return
*/ */
public int deleteSurProjectMaterialSealById(Long id); public int deleteSurProjectMaterialSealById(Long id);
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where);
} }

View File

@ -100,4 +100,9 @@ public class SurProjectMaterialSealServiceImpl implements ISurProjectMaterialSea
{ {
return surProjectMaterialSealMapper.deleteSurProjectMaterialSealById(id); return surProjectMaterialSealMapper.deleteSurProjectMaterialSealById(id);
} }
@Override
public List<SurProjectMaterialSeal> selectTop20(SurProjectMaterialSeal where) {
return surProjectMaterialSealMapper.selectTop20(where);
}
} }

View File

@ -142,4 +142,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<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, sp.projectName, sd.dept_name
from (
select * from sur_project_material_seal spme
where if(spme.is_del is null,0,spme.is_del)=0
<if test="deptId!=null and deptId>0"> and spme.project_id in (SELECT id FROM sur_project WHERE deptid=#{deptId}) </if>
<if test="projectId!=null and projectId>0">and spme.project_id = #{projectId}</if>
) spme
left join sur_project sp on spme.project_id = sp.id
left join sys_dept sd on sd.dept_id = spme.dept_id
order by spme.create_time desc
LIMIT 0,20
</select>
</mapper> </mapper>