首页图片新增版本查询
This commit is contained in:
parent
1fd0ed44a2
commit
4454b45ff9
|
|
@ -100,6 +100,16 @@ public class AdvertisementController extends BaseController {
|
||||||
return ApiResult.success(advertisementService.getList(request));
|
return ApiResult.success(advertisementService.getList(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取质量宣传图版本列表
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 质量宣传图版本列表
|
||||||
|
*/
|
||||||
|
@PostMapping("versions")
|
||||||
|
public ApiResult<List<AdvertisementListVO>> getAdvertisementVersions(@Valid @RequestBody @NotNull AdvertisementRequst request){
|
||||||
|
return ApiResult.success(advertisementService.getVersions(request.getType(), request.getPosition()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据类型获取质量宣传图
|
* 根据类型获取质量宣传图
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.nflg.wms.common.pojo.vo.AdvertisementListVO;
|
import com.nflg.wms.common.pojo.vo.AdvertisementListVO;
|
||||||
import com.nflg.wms.repository.entity.Advertisement;
|
import com.nflg.wms.repository.entity.Advertisement;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Mapper 接口
|
* Mapper 接口
|
||||||
|
|
@ -19,4 +21,6 @@ public interface AdvertisementMapper extends BaseMapper<Advertisement> {
|
||||||
Advertisement getByType(String type, String position);
|
Advertisement getByType(String type, String position);
|
||||||
|
|
||||||
IPage<AdvertisementListVO> getList(IPage<?> page);
|
IPage<AdvertisementListVO> getList(IPage<?> page);
|
||||||
|
|
||||||
|
List<AdvertisementListVO> getVersions(String type, String position);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ import com.nflg.wms.common.pojo.vo.AdvertisementListVO;
|
||||||
import com.nflg.wms.common.pojo.vo.AdvertisementVO;
|
import com.nflg.wms.common.pojo.vo.AdvertisementVO;
|
||||||
import com.nflg.wms.repository.entity.Advertisement;
|
import com.nflg.wms.repository.entity.Advertisement;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
|
|
@ -25,5 +27,7 @@ public interface IAdvertisementService extends IService<Advertisement> {
|
||||||
|
|
||||||
IPage<AdvertisementListVO> getList(PageQO request);
|
IPage<AdvertisementListVO> getList(PageQO request);
|
||||||
|
|
||||||
|
List<AdvertisementListVO> getVersions(String type, String position);
|
||||||
|
|
||||||
void enable(EnableBatchQO request);
|
void enable(EnableBatchQO request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,11 @@ public class AdvertisementServiceImpl extends ServiceImpl<AdvertisementMapper, A
|
||||||
return baseMapper.getList(new Page<>(request.getPage(), request.getPageSize()));
|
return baseMapper.getList(new Page<>(request.getPage(), request.getPageSize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AdvertisementListVO> getVersions(String type, String position) {
|
||||||
|
return baseMapper.getVersions(type, position);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable(EnableBatchQO request) {
|
public void enable(EnableBatchQO request) {
|
||||||
lambdaUpdate()
|
lambdaUpdate()
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,40 @@
|
||||||
INNER JOIN dictionary_item di1 ON ad.type = di1.id
|
INNER JOIN dictionary_item di1 ON ad.type = di1.id
|
||||||
INNER JOIN dictionary_item di2 ON ad.position = di2.id
|
INNER JOIN dictionary_item di2 ON ad.position = di2.id
|
||||||
where di1.code = #{type} AND di2.code=#{position} and ad.enable
|
where di1.code = #{type} AND di2.code=#{position} and ad.enable
|
||||||
ORDER BY CAST(SUBSTRING(ad.version, 2) AS UNSIGNED) DESC
|
ORDER BY CAST(SUBSTRING(ad.version, 2) AS INTEGER) DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.AdvertisementListVO">
|
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.AdvertisementListVO">
|
||||||
SELECT ad.*,di1.value AS "typeName",di2.value AS "positionName"
|
SELECT ranked.*
|
||||||
|
FROM (
|
||||||
|
SELECT ad.*,
|
||||||
|
di1.value AS "typeName",
|
||||||
|
di2.value AS "positionName",
|
||||||
|
ROW_NUMBER() OVER (
|
||||||
|
PARTITION BY ad.type, ad.position
|
||||||
|
ORDER BY CAST(SUBSTRING(ad.version, 2) AS INTEGER) DESC,
|
||||||
|
ad.create_time DESC,
|
||||||
|
ad.id DESC
|
||||||
|
) AS rn
|
||||||
FROM qms_advertisement ad
|
FROM qms_advertisement ad
|
||||||
INNER JOIN dictionary_item di1 ON ad.type=di1.id
|
INNER JOIN dictionary_item di1 ON ad.type=di1.id
|
||||||
INNER JOIN dictionary_item di2 ON ad.position=di2.id
|
INNER JOIN dictionary_item di2 ON ad.position=di2.id
|
||||||
|
) ranked
|
||||||
|
WHERE ranked.rn = 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getVersions" resultType="com.nflg.wms.common.pojo.vo.AdvertisementListVO">
|
||||||
|
SELECT ad.*,
|
||||||
|
di1.value AS "typeName",
|
||||||
|
di2.value AS "positionName"
|
||||||
|
FROM qms_advertisement ad
|
||||||
|
INNER JOIN dictionary_item di1 ON ad.type=di1.id
|
||||||
|
INNER JOIN dictionary_item di2 ON ad.position=di2.id
|
||||||
|
WHERE di1.code = #{type}
|
||||||
|
AND di2.code = #{position}
|
||||||
|
ORDER BY CAST(SUBSTRING(ad.version, 2) AS INTEGER) DESC,
|
||||||
|
ad.create_time DESC,
|
||||||
|
ad.id DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue