2026-04-09 10:40:04 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.nflg.wms.repository.mapper.AdvertisementMapper">
|
|
|
|
|
|
|
|
|
|
<select id="getByType" resultType="com.nflg.wms.repository.entity.Advertisement">
|
|
|
|
|
SELECT ad.*
|
2026-04-10 14:29:48 +08:00
|
|
|
FROM qms_advertisement ad
|
2026-04-09 10:40:04 +08:00
|
|
|
INNER JOIN dictionary_item di1 ON ad.type = di1.id
|
|
|
|
|
INNER JOIN dictionary_item di2 ON ad.position = di2.id
|
2026-06-13 11:59:16 +08:00
|
|
|
where di1.code = #{type} AND di2.code=#{position} and ad.enable
|
2026-06-25 09:31:20 +08:00
|
|
|
ORDER BY CAST(SUBSTRING(ad.version, 2) AS INTEGER) DESC
|
2026-06-24 17:33:43 +08:00
|
|
|
LIMIT 1
|
2026-04-09 10:40:04 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.AdvertisementListVO">
|
2026-06-25 09:31:20 +08:00
|
|
|
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
|
|
|
|
|
INNER JOIN dictionary_item di1 ON ad.type=di1.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"
|
2026-04-10 14:29:48 +08:00
|
|
|
FROM qms_advertisement ad
|
2026-04-09 10:40:04 +08:00
|
|
|
INNER JOIN dictionary_item di1 ON ad.type=di1.id
|
|
|
|
|
INNER JOIN dictionary_item di2 ON ad.position=di2.id
|
2026-06-25 09:31:20 +08:00
|
|
|
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
|
2026-04-09 10:40:04 +08:00
|
|
|
</select>
|
|
|
|
|
</mapper>
|