gunshi-project-ss/src/main/java/com/gunshi/project/xyt/mapper/RescueGoodsMapper.java

42 lines
1.5 KiB
Java
Raw Normal View History

2024-07-08 10:05:02 +08:00
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.file.model.FileDescriptor;
import com.gunshi.project.xyt.entity.so.RescueGoodsPageSo;
import com.gunshi.project.xyt.model.RescueGoodsB;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface RescueGoodsMapper extends BaseMapper<RescueGoodsB> {
@Select("""
<script>
2024-07-08 13:18:54 +08:00
select t.*
from public.rescue_goods_b t
<where>
2024-07-08 10:05:02 +08:00
<if test="obj.goodsName != null and obj.goodsName !=''">
2024-07-08 17:41:17 +08:00
t.goods_name LIKE concat('%',#{obj.goodsName},'%')
2024-07-08 10:05:02 +08:00
</if>
2024-07-08 17:41:17 +08:00
</where>
2024-07-08 10:05:02 +08:00
<if test="obj.sortField != null and obj.sortField !=''">
2024-07-08 17:41:17 +08:00
order by t.${obj.sortField} asc
2024-07-08 10:05:02 +08:00
</if>
</script>
""")
Page<RescueGoodsB> pageQuery(@Param("page") Page<RescueGoodsB> page,@Param("obj") RescueGoodsPageSo RescueGoodsPageSo);
@Select("""
<script>
select * from public.file_descriptor
where file_id in (select file_id from public.rescue_goods_file where goods_id = #{goodsId})
</script>
""")
List<FileDescriptor> detail(@Param("goodsId") Long goodsId);
}