You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.9 KiB
Java
51 lines
1.9 KiB
Java
package com.glxp.mipsdl.service.hlfyyy;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.glxp.mipsdl.entity.hlfyyy.VA010;
|
|
import com.glxp.mipsdl.req.base.UdiwmsBasicSkPrescribeRequest;
|
|
import com.glxp.mipsdl.thirddao.hlfyyy.VA006Mapper;
|
|
import com.glxp.mipsdl.thirddao.hlfyyy.VA010Mapper;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.glxp.mipsdl.entity.hlfyyy.VA006;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.ArrayList;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
|
|
@Service
|
|
public class VA006Service extends ServiceImpl<VA006Mapper, VA006> {
|
|
@Resource
|
|
private VA006Mapper va006Mapper;
|
|
@Value("${DSF_XML_SQL_TYPE:Mysql}")
|
|
private String defXmlSqlType;
|
|
public IPage<VA006> getList(Page page , UdiwmsBasicSkPrescribeRequest udiwmsBasicSkPrescribeRequest){
|
|
IPage<VA006> iPage = va006Mapper.getList(page,udiwmsBasicSkPrescribeRequest);
|
|
List<VA006> list = iPage.getRecords();
|
|
List<VA006> listNew = new ArrayList<>();
|
|
if(list!=null && list.size() >0){
|
|
String lastSql = "";
|
|
if(defXmlSqlType.equals("Mysql")){
|
|
lastSql = " limit 1";
|
|
|
|
}else if(defXmlSqlType.equals("Oracle")){
|
|
lastSql = "AND rownum = 1";
|
|
}
|
|
for (VA006 va006 : list) {
|
|
|
|
|
|
VA006 va006New = va006Mapper.selectOne(new QueryWrapper<VA006>().eq("code",va006.getCode()).last(lastSql));
|
|
listNew.add(va006New);
|
|
}
|
|
}
|
|
list.sort( Comparator.comparing(VA006::getPrescribedate));
|
|
iPage.setRecords(listNew);
|
|
|
|
return iPage;
|
|
}
|
|
}
|