提交 dc0551c0 作者: zhenjie

行业服务搜索

上级 98540b94
package com.mmc.pms.controller.inspection; package com.mmc.pms.controller.inspection;
import com.mmc.pms.common.Page;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.inspection.dto.InspectionDTO; import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
import com.mmc.pms.model.qo.InspectionQO;
import com.mmc.pms.service.inspection.InspectionService; import com.mmc.pms.service.inspection.InspectionService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses; import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
/** /**
...@@ -49,4 +52,11 @@ public class InspectionController { ...@@ -49,4 +52,11 @@ public class InspectionController {
public ResultBody<InspectionDTO> detail(@RequestParam Integer id){ public ResultBody<InspectionDTO> detail(@RequestParam Integer id){
return inspectionService.detail(id); return inspectionService.detail(id);
} }
@ApiOperation(value = "服务列表")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = InspectionDTO.class)})
@PostMapping("listInspectionPages")
public ResultBody<InspectionDTO> listInspectionPages(@Validated(Page.class) @RequestBody InspectionQO inspectionQO){
return inspectionService.listInspectionPages(inspectionQO);
}
} }
package com.mmc.pms.dao.inspection; package com.mmc.pms.dao.inspection;
import com.mmc.pms.entity.inspection.InspectionDO; import com.mmc.pms.entity.inspection.InspectionDO;
import com.mmc.pms.model.qo.InspectionQO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* @author: zj * @author: zj
* @Date: 2023/8/4 15:34 * @Date: 2023/8/4 15:34
...@@ -18,4 +21,8 @@ public interface InspectionDao { ...@@ -18,4 +21,8 @@ public interface InspectionDao {
void remove(Integer id); void remove(Integer id);
InspectionDO getInspectionById(Integer id); InspectionDO getInspectionById(Integer id);
int countListInspectionPages(InspectionQO inspectionQO);
List<InspectionDO> listInspectionPages(InspectionQO inspectionQO);
} }
...@@ -100,7 +100,6 @@ public class MallGoodsDO implements Serializable { ...@@ -100,7 +100,6 @@ public class MallGoodsDO implements Serializable {
this.labelShow = mallGoodsVO.getLabelShow(); this.labelShow = mallGoodsVO.getLabelShow();
this.priceShow = mallGoodsVO.getPriceShow(); this.priceShow = mallGoodsVO.getPriceShow();
this.goodsDetails = mallGoodsVO.getGoodsDetails(); this.goodsDetails = mallGoodsVO.getGoodsDetails();
this.hot = mallGoodsVO.getHot();
} }
public MallGoodsVO buildMallGoodsVO() { public MallGoodsVO buildMallGoodsVO() {
......
...@@ -78,7 +78,4 @@ public class MallGoodsVO implements Serializable { ...@@ -78,7 +78,4 @@ public class MallGoodsVO implements Serializable {
@ApiModelProperty(value = "店铺id 小程序用") @ApiModelProperty(value = "店铺id 小程序用")
private Integer userAccountId; private Integer userAccountId;
@ApiModelProperty(value = "商品热度")
private Integer hot;
} }
package com.mmc.pms.model.qo;
import com.mmc.pms.common.Page;
import com.mmc.pms.model.group.Freeze;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @author: zj
* @Date: 2023/10/18 14:42
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class InspectionQO implements Serializable {
private static final long serialVersionUID = 6272003703156261356L;
@ApiModelProperty(value = "关键字")
private String keyword;
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = {Page.class, Freeze.class})
@Min(value = 1, groups = Page.class)
private Integer pageSize;
public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize;
}
}
...@@ -3,6 +3,7 @@ package com.mmc.pms.service.inspection; ...@@ -3,6 +3,7 @@ package com.mmc.pms.service.inspection;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.inspection.dto.InspectionDTO; import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
import com.mmc.pms.model.qo.InspectionQO;
/** /**
* @author: zj * @author: zj
...@@ -16,4 +17,6 @@ public interface InspectionService { ...@@ -16,4 +17,6 @@ public interface InspectionService {
ResultBody remove(Integer id); ResultBody remove(Integer id);
ResultBody<InspectionDTO> detail(Integer id); ResultBody<InspectionDTO> detail(Integer id);
ResultBody<InspectionDTO> listInspectionPages(InspectionQO inspectionQO);
} }
...@@ -8,11 +8,16 @@ import com.mmc.pms.entity.inspection.InspectionDO; ...@@ -8,11 +8,16 @@ import com.mmc.pms.entity.inspection.InspectionDO;
import com.mmc.pms.model.inspection.dto.InspectionDTO; import com.mmc.pms.model.inspection.dto.InspectionDTO;
import com.mmc.pms.model.inspection.vo.InspectionVO; import com.mmc.pms.model.inspection.vo.InspectionVO;
import com.mmc.pms.model.qo.CompanyInspectionQO; import com.mmc.pms.model.qo.CompanyInspectionQO;
import com.mmc.pms.model.qo.InspectionQO;
import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.inspection.CompanyInspectionService; import com.mmc.pms.service.inspection.CompanyInspectionService;
import com.mmc.pms.service.inspection.InspectionService; import com.mmc.pms.service.inspection.InspectionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @author: zj * @author: zj
* @Date: 2023/8/4 16:31 * @Date: 2023/8/4 16:31
...@@ -68,4 +73,17 @@ public class InspectionServiceImpl implements InspectionService { ...@@ -68,4 +73,17 @@ public class InspectionServiceImpl implements InspectionService {
} }
return ResultBody.success(inspectionDO.buildInspectionDTO()); return ResultBody.success(inspectionDO.buildInspectionDTO());
} }
@Override
public ResultBody<InspectionDTO> listInspectionPages(InspectionQO inspectionQO) {
int count = inspectionDao.countListInspectionPages(inspectionQO);
if (count == 0) {
return ResultBody.success(PageResult.buildPage(inspectionQO.getPageNo(), inspectionQO.getPageSize(), count));
}
int pageNo = inspectionQO.getPageNo();
inspectionQO.buildCurrentPage();
List<InspectionDO> inspectionDOS = inspectionDao.listInspectionPages(inspectionQO);
List<InspectionDTO> inspectionDTOS = inspectionDOS.stream().map(InspectionDO::buildInspectionDTO).collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, inspectionQO.getPageSize(), count, inspectionDTOS));
}
} }
...@@ -7,20 +7,9 @@ spring: ...@@ -7,20 +7,9 @@ spring:
password: IUAV_DEV@2023&MYSQL password: IUAV_DEV@2023&MYSQL
redis: redis:
database: 1 database: 1
host: 127.0.0.1 host: r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
port: 6379 port: 6379
#连接池 password: MMC@2022&REDIS
lettuce:
shutdown-timeout: 1000 # 关闭超时时间-ms
pool:
#最大连接个数
max-active: 30
#等待时间-ms
max-wait: 1000ms
#最大空闲
max-idle: 8
#初始化最小
min-idle: 1
servlet: servlet:
multipart: multipart:
max-file-size: 512MB max-file-size: 512MB
......
...@@ -77,4 +77,36 @@ ...@@ -77,4 +77,36 @@
where ins.is_deleted = 0 where ins.is_deleted = 0
and ins.id = #{id} and ins.id = #{id}
</select> </select>
<select id="countListInspectionPages" resultType="java.lang.Integer" parameterType="com.mmc.pms.model.qo.InspectionQO">
select count(*) from inspection ins
where ins.is_deleted = 0
<if test="keyword != null">
and (ins.inspection_name like concat('%',#{keyword},'%') or
ins.inspection_no like concat('%',#{keyword},'%')
)
</if>
</select>
<select id="listInspectionPages" resultType="com.mmc.pms.entity.inspection.InspectionDO" parameterType="com.mmc.pms.model.qo.InspectionQO">
select ins.id,
ins.inspection_no,
ins.inspection_name,
ins.industry_type_id,
ins.inspection_img,
ins.inspection_description,
ins.sale_state,
ins.case_img,
ins.case_video,
ins.create_time
from inspection ins
where ins.is_deleted = 0
<if test="keyword != null">
and (ins.inspection_name like concat('%',#{keyword},'%') or
ins.inspection_no like concat('%',#{keyword},'%')
)
</if>
order by ins.id desc
limit #{pageNo}, #{pageSize}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论