Commit c64bccee authored by 周健威's avatar 周健威

修改

parent 56b42866
......@@ -78,6 +78,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return selectByExample(example);
}
public List<T> selectByBuilder(Function<Example.Builder, Example.Builder> builderFun, String orderStr) {
Example.Builder builder = builderFun.apply(new Example.Builder(entityClass));
Example example = builder.build();
if(StrUtil.isNotBlank(orderStr)) {
example.setOrderByClause(orderStr);
}
return selectByExample(example);
}
public List<T> selectByWeekendsOr(Supplier<List<WeekendSqls<T>>> where, String orderStr) {
List<WeekendSqls<T>> whereSqlss = where.get();
Example.Builder builder = new Example.Builder(entityClass);
......
package com.xxfc.platform.order.biz;
import com.xxfc.platform.order.rest.ShuntApplyController;
import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.mapper.ShuntApplyMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/**
* 调车申请
*
......@@ -15,4 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public class ShuntApplyBiz extends BaseBiz<ShuntApplyMapper, ShuntApply> {
public List<ShuntApply> pageList(ShuntApplyController.QueryDTO dto){
return mapper.pageList(dto);
}
}
\ No newline at end of file
package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.rest.ShuntApplyController;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/**
* 调车申请
*
......@@ -11,5 +14,6 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2020-09-09 14:49:51
*/
public interface ShuntApplyMapper extends Mapper<ShuntApply> {
public List<ShuntApply> pageList(ShuntApplyController.QueryDTO dto);
}
......@@ -41,6 +41,7 @@ import lombok.Data;
import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.List;
import java.util.Map;
......@@ -170,11 +171,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
}
dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
Query query = new Query(dto);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> {
w.andEqualTo(ShuntApply::getUserId, dto.getUserId());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
return w;
}, " crt_time desc "), ShuntApplyVO.class);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.pageList(dto), ShuntApplyVO.class);
pages.getData().forEach(data -> {
data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData());
});
......@@ -223,7 +220,13 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Data
public static class QueryDTO extends PageParam {
public static final int PAGE_STATUS_ING = 1;
public static final int PAGE_STATUS_TOPAY = 2;
public static final int PAGE_STATUS_PAYED = 3;
public static final int PAGE_STATUS_CNL = 4;
Integer userId;
Integer pageStatus;
}
@Data
......
......@@ -24,4 +24,32 @@
<result property="endCompanyName" column="end_company_name"/>
</resultMap>
<select id="pageList" resultType="com.xxfc.platform.order.entity.ShuntApply">
select *
from shunt_apply
<where>
is_del = 0
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="pageStatus != null">
<if test="pageStatus == 1">
and status = 1
</if>
<if test="pageStatus == 2">
and ((status = 4 and order_status = 1) or status = 3)
</if>
<if test="pageStatus == 3">
and status = 4 and order_status = 2
</if>
<if test="pageStatus == 4">
and status in (2, 501, 502, 503, 504)
</if>
</if>
</where>
order by crt_time desc
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment