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

Merge branch 'master-chw' into dev-chw

parents 29922bc5 db66ce15
...@@ -78,6 +78,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> { ...@@ -78,6 +78,15 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return selectByExample(example); 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) { public List<T> selectByWeekendsOr(Supplier<List<WeekendSqls<T>>> where, String orderStr) {
List<WeekendSqls<T>> whereSqlss = where.get(); List<WeekendSqls<T>> whereSqlss = where.get();
Example.Builder builder = new Example.Builder(entityClass); Example.Builder builder = new Example.Builder(entityClass);
......
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import com.xxfc.platform.order.rest.ShuntApplyController;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.xxfc.platform.order.entity.ShuntApply; import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.mapper.ShuntApplyMapper; import com.xxfc.platform.order.mapper.ShuntApplyMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import java.util.List;
/** /**
* 调车申请 * 调车申请
* *
...@@ -15,4 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz; ...@@ -15,4 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/ */
@Service @Service
public class ShuntApplyBiz extends BaseBiz<ShuntApplyMapper, ShuntApply> { 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; package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.ShuntApply; import com.xxfc.platform.order.entity.ShuntApply;
import com.xxfc.platform.order.rest.ShuntApplyController;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List;
/** /**
* 调车申请 * 调车申请
* *
...@@ -11,5 +14,6 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,5 +14,6 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2020-09-09 14:49:51 * @date 2020-09-09 14:49:51
*/ */
public interface ShuntApplyMapper extends Mapper<ShuntApply> { public interface ShuntApplyMapper extends Mapper<ShuntApply> {
public List<ShuntApply> pageList(ShuntApplyController.QueryDTO dto);
} }
...@@ -41,6 +41,7 @@ import lombok.Data; ...@@ -41,6 +41,7 @@ import lombok.Data;
import org.mockito.internal.util.collections.Sets; import org.mockito.internal.util.collections.Sets;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.weekend.WeekendSqls;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -170,11 +171,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -170,11 +171,7 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
} }
dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID())); dto.setUserId(Integer.valueOf(BaseContextHandler.getUserID()));
Query query = new Query(dto); Query query = new Query(dto);
PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.selectByWeekend(w -> { PageDataVO<ShuntApplyVO> pages = PageDataVO.pageInfo(query, () -> baseBiz.pageList(dto), ShuntApplyVO.class);
w.andEqualTo(ShuntApply::getUserId, dto.getUserId());
w.andEqualTo(ShuntApply::getIsDel, SYS_FALSE);
return w;
}, " crt_time desc "), ShuntApplyVO.class);
pages.getData().forEach(data -> { pages.getData().forEach(data -> {
data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData()); data.setAppUserDTO(userFeign.userDetailById(data.getUserId()).getData());
}); });
...@@ -223,7 +220,13 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp ...@@ -223,7 +220,13 @@ public class ShuntApplyController extends BaseController<ShuntApplyBiz, ShuntApp
@Data @Data
public static class QueryDTO extends PageParam { 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 userId;
Integer pageStatus;
} }
@Data @Data
......
...@@ -24,4 +24,32 @@ ...@@ -24,4 +24,32 @@
<result property="endCompanyName" column="end_company_name"/> <result property="endCompanyName" column="end_company_name"/>
</resultMap> </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> </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