遥感同种类型默认只展示一个,遥感新增接口getSensings
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.desk.entity.Notice; |
| | | import org.springblade.modules.remote.wrapper.RemoteWrapper; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 控制器 |
| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @GetMapping("/getSensings") |
| | | public R getSensing(String type){ |
| | | return R.data(remoteService.getRemoteList(type)); |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | */ |
| | |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入remote") |
| | | public R submit(@Valid @RequestBody Remote remote) { |
| | | if (remote.getReType().equals("0")) {//判断是否修改为展示 |
| | | //查找当前类型默认展示的数量 |
| | | List<Remote> remoteList = remoteService.findByType(remote); |
| | | if (remoteList.size() > 0) { |
| | | throw new org.springblade.core.log.exception.ServiceException(StringUtil.format("该类型已有默认展示,请先取消默认展示")); |
| | | } |
| | | } |
| | | return R.status(remoteService.saveOrUpdate(remote)); |
| | | } |
| | | |
| | |
| | | */ |
| | | private String reTp; |
| | | /** |
| | | * 0麻姑米集团、1水龙米业、2有机基地、3绿色基地 |
| | | * 0麻姑米集团、1水龙米业、2有机基地、3绿色基地、4育秧中心 |
| | | */ |
| | | private Integer type; |
| | | |
| | |
| | | */ |
| | | package org.springblade.modules.remote.mapper; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.remote.entity.Remote; |
| | | import org.springblade.modules.remote.vo.RemoteVO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | */ |
| | | List<RemoteVO> selectRemotePage(IPage page, RemoteVO remote); |
| | | |
| | | List<Remote> findByType(@Param("remote") Remote remote); |
| | | |
| | | List<Remote> getRemoteList(@Param("type") String type); |
| | | } |
| | |
| | | select * |
| | | from sys_remote |
| | | where is_deleted = 0 |
| | | ORDER BY id DESC |
| | | </select> |
| | | |
| | | <select id="findByType" resultType="org.springblade.modules.remote.entity.Remote"> |
| | | SELECT * |
| | | FROM sys_remote r |
| | | WHERE 1=1 AND r.re_type = 0 |
| | | <if test="remote.type!=null and remote.type != '' or remote.type != 0 " > |
| | | AND r.type = #{remote.type} |
| | | </if> |
| | | AND r.is_deleted = 0 |
| | | |
| | | </select> |
| | | <select id="getRemoteList" resultType="org.springblade.modules.remote.entity.Remote"> |
| | | select |
| | | id,create_user,create_dept,create_time,update_user,update_time,status,is_deleted, |
| | | re_name,re_url,re_time,re_type,release_time,re_context,re_tp,type |
| | | from sys_remote |
| | | WHERE 1=1 AND is_deleted = 0 |
| | | <if test="type == 'ALL' "> |
| | | |
| | | </if> |
| | | <if test=" type =='SHOW' "> |
| | | AND re_type = 0 |
| | | </if> |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 服务类 |
| | | * |
| | |
| | | */ |
| | | IPage<RemoteVO> selectRemotePage(IPage<RemoteVO> page, RemoteVO remote); |
| | | |
| | | List<Remote> findByType(Remote remote); |
| | | |
| | | List<Remote> getRemoteList(String type); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | | * |
| | |
| | | return page.setRecords(baseMapper.selectRemotePage(page, remote)); |
| | | } |
| | | |
| | | @Override |
| | | public List<Remote> findByType(Remote remote) { |
| | | return baseMapper.findByType(remote); |
| | | } |
| | | |
| | | @Override |
| | | public List<Remote> getRemoteList(String type) { |
| | | return baseMapper.getRemoteList(type); |
| | | } |
| | | |
| | | } |