Browse Source

查询优化

contract
Yen 2 years ago
parent
commit
2efbfc6766
  1. 1
      src/main/java/com/qs/serve/modules/biz/controller/BizVisitController.java
  2. 2
      src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java
  3. 2
      src/main/java/com/qs/serve/modules/bms/controller/BmsCostCenterController.java
  4. 1
      src/main/java/com/qs/serve/modules/bms/controller/BmsFactoryController.java
  5. 2
      src/main/java/com/qs/serve/modules/bms/controller/BmsSubjectController.java
  6. 1
      src/main/java/com/qs/serve/modules/bms/controller/BmsSubjectFormController.java
  7. 1
      src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierVisitFormController.java
  8. 1
      src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierVisitTypeController.java
  9. 2
      src/main/java/com/qs/serve/modules/bms/entity/BmsChannel.java
  10. 3
      src/main/java/com/qs/serve/modules/bms/entity/BmsChannelPoint.java
  11. 1
      src/main/java/com/qs/serve/modules/bms/entity/BmsSupplier.java
  12. 2
      src/main/java/com/qs/serve/modules/bms/entity/BmsSupplierVisitForm.java
  13. 1
      src/main/java/com/qs/serve/modules/goods/controller/GoodsCategoryController.java
  14. 1
      src/main/java/com/qs/serve/modules/goods/entity/GoodsSpecValue.java
  15. 2
      src/main/java/com/qs/serve/modules/goods/entity/GoodsSpu.java
  16. 4
      src/main/java/com/qs/serve/modules/pay/entity/so/PayPaymentSo.java
  17. 3
      src/main/java/com/qs/serve/modules/qms/controller/QmsGroupController.java
  18. 5
      src/main/java/com/qs/serve/modules/qms/entity/QmsGroup.java
  19. 2
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  20. 1
      src/main/java/com/qs/serve/modules/tbs/entity/TbsActivityTemplateLog.java
  21. 3
      src/main/java/com/qs/serve/modules/wx/entity/WxUser.java
  22. 1
      src/main/resources/mapper/bms/BmsChannelPointMapper.xml
  23. 1
      src/main/resources/mapper/bms/BmsSupplierAddressMapper.xml
  24. 1
      src/main/resources/mapper/bms/BmsSupplierChannelMapper.xml
  25. 1
      src/main/resources/mapper/bms/BmsSupplierMapper.xml
  26. 1
      src/main/resources/mapper/goods/GoodsSkuMapper.xml
  27. 4
      src/main/resources/mapper/goods/GoodsSpuMapper.xml
  28. 4
      src/main/resources/mapper/sys/SysUserMapper.xml

1
src/main/java/com/qs/serve/modules/biz/controller/BizVisitController.java

@ -41,6 +41,7 @@ public class BizVisitController {
public R<PageVo<BizVisit>> getPage(BizVisit param){
PageUtil.startPage();
LambdaQueryWrapper<BizVisit> visitWrapper = new LambdaQueryWrapper<>(param);
visitWrapper.orderByDesc(BizVisit::getId);
List<BizVisit> list = bizVisitService.list(visitWrapper);
return R.byPageHelperList(list);
}

2
src/main/java/com/qs/serve/modules/bms/controller/BmsChannelController.java

@ -8,6 +8,7 @@ import com.qs.serve.common.model.enums.BizType;
import com.qs.serve.common.model.enums.SystemModule;
import com.qs.serve.common.util.PageUtil;
import com.qs.serve.modules.bms.entity.BmsChannelPoint;
import com.qs.serve.modules.bms.entity.BmsSupplierVisitType;
import com.qs.serve.modules.bms.service.BmsChannelPointService;
import com.qs.serve.modules.tbs.entity.TbsActivityChannel;
import com.qs.serve.modules.tbs.service.TbsActivityChannelService;
@ -48,6 +49,7 @@ public class BmsChannelController {
public R<PageVo<BmsChannel>> getPage(BmsChannel param){
PageUtil.startPage();
LambdaQueryWrapper<BmsChannel> channelWrapper = new LambdaQueryWrapper<>(param);
channelWrapper.orderByDesc(BmsChannel::getCreateTime);
List<BmsChannel> list = bmsChannelService.list(channelWrapper);
return R.byPageHelperList(list);
}

2
src/main/java/com/qs/serve/modules/bms/controller/BmsCostCenterController.java

@ -58,7 +58,7 @@ public class BmsCostCenterController {
if(loadByCurrent!=null&&loadByCurrent.equals(1)){
return getTreeByCurrentUser();
}
List<BmsCostCenter> list = bmsCostCenterService.list();
List<BmsCostCenter> list = bmsCostCenterService.list(new LambdaQueryWrapper<BmsCostCenter>().orderByDesc(BmsCostCenter::getId));
List<BmsCostCenterTreeVo> treeVoList = list.stream().map(obj->{
BmsCostCenterTreeVo treeNode = CopierUtil.copy(obj,new BmsCostCenterTreeVo());
treeNode.setId(obj.getId().toString());

1
src/main/java/com/qs/serve/modules/bms/controller/BmsFactoryController.java

@ -48,6 +48,7 @@ public class BmsFactoryController {
public R<PageVo<BmsFactory>> getPage(BmsFactory param){
PageUtil.startPage();
LambdaQueryWrapper<BmsFactory> factoryWrapper = new LambdaQueryWrapper<>(param);
factoryWrapper.orderByDesc(BmsFactory::getCreateTime);
List<BmsFactory> list = bmsFactoryService.list(factoryWrapper);
return R.byPageHelperList(list);
}

2
src/main/java/com/qs/serve/modules/bms/controller/BmsSubjectController.java

@ -55,7 +55,7 @@ public class BmsSubjectController {
@GetMapping("/tree")
@PreAuthorize("hasRole('bms:subject:query')")
public R<List<BmsSubjectTreeVo>> getPage(String supplierId){
List<BmsSubject> subjectList = bmsSubjectService.list();
List<BmsSubject> subjectList = bmsSubjectService.list(new LambdaQueryWrapper<BmsSubject>().orderByDesc(BmsSubject::getId));
List<BmsSubjectTreeVo> treeVoList = subjectList.stream().map(subject->{
BmsSubjectTreeVo treeNode = CopierUtil.copy(subject,new BmsSubjectTreeVo());
treeNode.setId(subject.getId().toString());

1
src/main/java/com/qs/serve/modules/bms/controller/BmsSubjectFormController.java

@ -44,6 +44,7 @@ public class BmsSubjectFormController {
public R<PageVo<BmsSubjectForm>> getPage(BmsSubjectForm param){
BmsSubjectForm entity = CopierUtil.copy(param,new BmsSubjectForm());
LambdaQueryWrapper<BmsSubjectForm> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(BmsSubjectForm::getId);
PageUtil.startPage();
List<BmsSubjectForm> list = bmsSubjectFormService.list(lqw);
return R.byPageHelperList(list);

1
src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierVisitFormController.java

@ -56,6 +56,7 @@ public class BmsSupplierVisitFormController {
public R<PageVo<BmsSupplierVisitForm>> getPage(BmsSupplierVisitForm param){
LambdaQueryWrapper<BmsSupplierVisitForm> lqw = new LambdaQueryWrapper<>(param);
PageUtil.startPage();
lqw.orderByDesc(BmsSupplierVisitForm::getCreateTime);
List<BmsSupplierVisitForm> list = bmsSupplierVisitFormService.list(lqw);
return R.byPageHelperList(list);
}

1
src/main/java/com/qs/serve/modules/bms/controller/BmsSupplierVisitTypeController.java

@ -59,6 +59,7 @@ public class BmsSupplierVisitTypeController {
public R<PageVo<BmsSupplierVisitType>> getPage(BmsSupplierVisitType param){
LambdaQueryWrapper<BmsSupplierVisitType> lqw = new LambdaQueryWrapper<>(param);
PageUtil.startPage();
lqw.orderByDesc(BmsSupplierVisitType::getCreateTime);
List<BmsSupplierVisitType> list = bmsSupplierVisitTypeService.list(lqw);
return R.byPageHelperList(list);
}

2
src/main/java/com/qs/serve/modules/bms/entity/BmsChannel.java

@ -32,11 +32,13 @@ public class BmsChannel implements Serializable {
/** 渠道编码 */
@NotBlank(message = "渠道编码不能为空")
@Length(max = 50,message = "渠道编码长度不能超过50字")
@TableField(condition = SqlCondition.LIKE)
private String channelCode;
/** 渠道名称 */
@NotBlank(message = "渠道名称不能为空")
@Length(max = 30,message = "渠道名称长度不能超过30字")
@TableField(condition = SqlCondition.LIKE)
private String channelName;
/** 渠道类型(读取数据字典) */

3
src/main/java/com/qs/serve/modules/bms/entity/BmsChannelPoint.java

@ -33,16 +33,19 @@ public class BmsChannelPoint implements Serializable {
@NotNull(message = "渠道名称不能为空")
private Long channelId;
@TableField(condition = SqlCondition.LIKE)
private String channelName;
/** 站点编码 */
@NotBlank(message = "站点编码不能为空")
@Length(max = 50,message = "站点编码长度不能超过50字")
@TableField(condition = SqlCondition.LIKE)
private String pointCode;
/** 站点名称 */
@NotBlank(message = "站点名称不能为空")
@Length(max = 30,message = "站点名称长度不能超过30字")
@TableField(condition = SqlCondition.LIKE)
private String pointName;
/** 店铺面积 */

1
src/main/java/com/qs/serve/modules/bms/entity/BmsSupplier.java

@ -78,6 +78,7 @@ public class BmsSupplier implements Serializable {
/** 客户编码 */
@NotBlank(message = "客户编码不能为空")
@Length(max = 20,message = "客户编码长度不能超过20字")
@TableField(condition = SqlCondition.LIKE)
private String code;
/** 父级id */

2
src/main/java/com/qs/serve/modules/bms/entity/BmsSupplierVisitForm.java

@ -34,10 +34,12 @@ public class BmsSupplierVisitForm implements Serializable {
/** 标题 */
@NotBlank(message = "标题不能为空")
@Length(max = 40,message = "标题长度不能超过40字")
@TableField(condition = SqlCondition.LIKE)
private String title;
/** 子标题 */
@Length(max = 255,message = "子标题长度不能超过255字")
@TableField(condition = SqlCondition.LIKE)
private String subtitle;
/** 描述 */

1
src/main/java/com/qs/serve/modules/goods/controller/GoodsCategoryController.java

@ -59,6 +59,7 @@ public class GoodsCategoryController {
public R<PageVo<GoodsCategory>> getMgrPage(GoodsCategory param){
PageUtil.startPage();
LambdaQueryWrapper<GoodsCategory> categoryWrapper = new LambdaQueryWrapper<>(param);
categoryWrapper.orderByDesc(GoodsCategory::getId);
List<GoodsCategory> list = goodsCategoryService.list(categoryWrapper);
return R.byPageHelperList(list);
}

1
src/main/java/com/qs/serve/modules/goods/entity/GoodsSpecValue.java

@ -36,6 +36,7 @@ public class GoodsSpecValue implements Serializable {
/** 名称 */
@NotBlank(message = "名称不能为空")
@Length(max = 50,message = "名称长度不能超过50字")
@TableField(condition = SqlCondition.LIKE)
private String name;
/** 创建时间 */

2
src/main/java/com/qs/serve/modules/goods/entity/GoodsSpu.java

@ -34,11 +34,13 @@ public class GoodsSpu implements Serializable {
/** 商品编码 */
@NotBlank(message = "商品编码不能为空")
@Length(max = 32,message = "商品编码长度不能超过32字")
@TableField(condition = SqlCondition.LIKE)
private String spuCode;
/** 商品名字 */
@NotBlank(message = "商品名字不能为空")
@Length(max = 200,message = "商品名字长度不能超过200字")
@TableField(condition = SqlCondition.LIKE)
private String name;
/** 一级分类、品牌ID */

4
src/main/java/com/qs/serve/modules/pay/entity/so/PayPaymentSo.java

@ -52,5 +52,9 @@ public class PayPaymentSo implements Serializable {
/** 取消标识 */
private Integer cancelFlag;
/** 发票编号 */
private String billNumber;
}

3
src/main/java/com/qs/serve/modules/qms/controller/QmsGroupController.java

@ -65,6 +65,9 @@ public class QmsGroupController {
@GetMapping("/page")
@PreAuthorize("hasRole('qms:group:query')")
public R<PageVo<QmsGroup>> getPage(QmsGroup param){
if(!StringUtils.hasText(param.getName())){
param.setName(param.getTitle());
}
PageUtil.startPage();
LambdaQueryWrapper<QmsGroup> groupWrapper = new LambdaQueryWrapper<>(param);
groupWrapper.orderByDesc(QmsGroup::getCreateTime);

5
src/main/java/com/qs/serve/modules/qms/entity/QmsGroup.java

@ -38,6 +38,7 @@ public class QmsGroup implements Serializable {
/** 标题 */
@NotBlank(message = "标题不能为空")
@Length(max = 20,message = "标题长度不能超过20字")
@TableField(condition = SqlCondition.LIKE)
private String name;
/** 描述 */
@ -131,5 +132,9 @@ public class QmsGroup implements Serializable {
@TableField(exist = false)
private Integer finished;
/** 纠正 管理页面查询参数 */
@TableField(exist = false)
private String title;
}

2
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java

@ -106,6 +106,7 @@ public class TbsCostApplyController {
public R<List<TbsCostApply>> getList(TbsCostApplyVo param){
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.orderByDesc(TbsCostApply::getId);
PageUtil.startPage();
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.ok(list);
@ -127,6 +128,7 @@ public class TbsCostApplyController {
TbsCostApply entity = CopierUtil.copy(param,new TbsCostApply());
LambdaQueryWrapper<TbsCostApply> lqw = new LambdaQueryWrapper<>(entity);
lqw.in(TbsCostApply::getCreateBy,userIds);
lqw.orderByDesc(TbsCostApply::getId);
PageUtil.startPage();
List<TbsCostApply> list = tbsCostApplyService.list(lqw);
return R.ok(list);

1
src/main/java/com/qs/serve/modules/tbs/entity/TbsActivityTemplateLog.java

@ -38,6 +38,7 @@ public class TbsActivityTemplateLog implements Serializable {
/** 模板名称 */
@NotBlank(message = "模板名称不能为空")
@Length(max = 30,message = "模板名称长度不能超过30字")
@TableField(condition = SqlCondition.LIKE)
private String templateName;
/** 操作状态:0:关闭;1-开启;2-删除;3-修改 */

3
src/main/java/com/qs/serve/modules/wx/entity/WxUser.java

@ -59,9 +59,11 @@ public class WxUser implements Serializable {
private String openId;
/** wx昵称 */
@TableField(condition = SqlCondition.LIKE)
private String nickName;
/** 员工昵称 */
@TableField(condition = SqlCondition.LIKE)
private String empName;
/** 性别(1:男,2:女,0:未知) */
@ -77,6 +79,7 @@ public class WxUser implements Serializable {
private String province;
/** 手机号码 */
@TableField(condition = SqlCondition.LIKE)
private String phone;
/** 用户语言 */

1
src/main/resources/mapper/bms/BmsChannelPointMapper.xml

@ -90,6 +90,7 @@
<if test="query.updateBy != null and query.updateBy != ''"> and `bms_channel_point`.`update_by` = #{query.updateBy}</if>
<if test="query.costFlag != null and query.costFlag != ''"> and `bms_channel_point`.`cost_flag` = #{query.costFlag}</if>
</where>
ORDER BY `bms_channel_point`.`create_time` DESC
</select>
</mapper>

1
src/main/resources/mapper/bms/BmsSupplierAddressMapper.xml

@ -79,6 +79,7 @@
<if test="query.supplierName != null and query.supplierName != ''"> and `bms_supplier`.`name` like concat('%',#{query.supplierName},'%')</if>
<if test="query.supplierCode != null and query.supplierCode != ''"> and `bms_supplier`.`code` like concat('%',#{query.supplierCode},'%')</if>
</where>
ORDER BY `bms_supplier_address`.`create_time` DESC
</select>
</mapper>

1
src/main/resources/mapper/bms/BmsSupplierChannelMapper.xml

@ -58,6 +58,7 @@
and `bms_channel`.`del_flag` = '0'
and `bms_supplier`.`del_flag` = '0'
</where>
ORDER BY `bms_supplier_channel`.`create_time` DESC
</select>
</mapper>

1
src/main/resources/mapper/bms/BmsSupplierMapper.xml

@ -110,6 +110,7 @@
</foreach>
</if>
</where>
ORDER BY `bms_supplier`.`update_time` DESC
</select>
</mapper>

1
src/main/resources/mapper/goods/GoodsSkuMapper.xml

@ -128,6 +128,7 @@
</foreach>
</if>
</where>
ORDER BY `goods_sku`.`create_date` DESC
</select>
<select id="selectByCategoryIds" resultType="com.qs.serve.modules.goods.entity.GoodsSku">

4
src/main/resources/mapper/goods/GoodsSpuMapper.xml

@ -64,8 +64,8 @@
LEFT JOIN `goods_category` `cate3` ON `cate3`.`id` = `goods_spu`.`category_third`
<where>
<if test="query.id != null"> and `goods_spu`.`id` = #{query.id}</if>
<if test="query.spuCode != null and query.spuCode != ''"> and `goods_spu`.`spu_code` = #{query.spuCode}</if>
<if test="query.name != null and query.name != ''"> and `goods_spu`.`name` = #{query.name}</if>
<if test="query.spuCode != null and query.spuCode != ''"> and `goods_spu`.`spu_code` like concat('%', #{query.spuCode},'%')</if>
<if test="query.name != null and query.name != ''"> and `goods_spu`.`name` like concat('%', #{query.name},'%') </if>
<if test="query.categoryFirst != null"> and `goods_spu`.`category_first` = #{query.categoryFirst}</if>
<if test="query.categorySecond != null"> and `goods_spu`.`category_second` = #{query.categorySecond}</if>
<if test="query.categoryThird != null"> and `goods_spu`.`category_third` = #{query.categoryThird}</if>

4
src/main/resources/mapper/sys/SysUserMapper.xml

@ -62,8 +62,8 @@
<if test="query.id != null and query.id != ''"> and sys_user.id = #{query.id}</if>
<if test="query.mobile != null and query.mobile != ''"> and sys_user.mobile = #{query.mobile}</if>
<if test="query.account != null and query.account != ''"> and sys_user.account = #{query.account}</if>
<if test="query.name != null and query.name != ''"> and sys_user.name = #{query.name}</if>
<if test="query.code != null and query.code != ''"> and sys_user.code = #{query.code}</if>
<if test="query.name != null and query.name != ''"> and sys_user.name like concat('%',#{query.name},'%') </if>
<if test="query.code != null and query.code != ''"> and sys_user.code like concat('%',#{query.code},'%') </if>
<if test="query.password != null and query.password != ''"> and sys_user.password = #{query.password}</if>
<if test="query.icon != null and query.icon != ''"> and sys_user.icon = #{query.icon}</if>
<if test="query.deptId != null and query.deptId != ''"> and sys_user.dept_id = #{query.deptId}</if>

Loading…
Cancel
Save