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

56 lines
2.1 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>
select
<if test = "obj.type == 1">
t.*,s.warehouse_name
</if>
<if test = "obj.type == 2">
t.*
</if>
from public._rescue_goods_b t
<if test = "obj.type == 1">
left join public._warehouse_b s on t.warehouse_id = s.warehouse_id
</if>
where t.type = #{obj.type}
<if test="obj.code != null and obj.code !=''">
and t.code = #{obj.code}
</if>
<if test="obj.goodsName != null and obj.goodsName !=''">
and t.goods_name LIKE concat('%',#{obj.goodsName},'%')
</if>
<if test="obj.warehouseId != null">
and t.warehouse_id =#{obj.warehouseId}
</if>
<if test="obj.sortField != null and obj.sortField !=''">
order by ${obj.sortField} asc
</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);
}