Commit c9b80084 authored by ysongq's avatar ysongq

条件分页查询企业审核

parent 052851e7
...@@ -23,7 +23,7 @@ public enum OrderMethodEnum { ...@@ -23,7 +23,7 @@ public enum OrderMethodEnum {
MONTH("MONTH", "03"), MONTH("MONTH", "03"),
/** /**
* *
*/ */
SECOND("SECOND", "04"), SECOND("SECOND", "04"),
; ;
......
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,7 @@
and t1.category_id = #{categoryId} and t1.category_id = #{categoryId}
</if> </if>
<if test="dataName != null and dataName != ''"> <if test="dataName != null and dataName != ''">
and data_name = #{dataName} and data_name like concat('%',#{dataName},'%')
</if> </if>
<if test="dataType != null and dataType != ''"> <if test="dataType != null and dataType != ''">
and data_type = #{dataType} and data_type = #{dataType}
......
package com.jz.manage.moduls.controller.customer; package com.jz.manage.moduls.controller.customer;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.manage.moduls.controller.BaseController; import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import com.jz.manage.moduls.service.DepartmentService; import com.jz.manage.moduls.service.DepartmentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/** /**
* 企业(Department)表控制层 * 企业(Department)表控制层
* *
...@@ -14,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -14,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
*/ */
@RestController @RestController
@RequestMapping("department") @RequestMapping("department")
@Api(tags = "企业")
public class DepartmentController extends BaseController { public class DepartmentController extends BaseController {
/** /**
* 服务对象 * 服务对象
...@@ -21,5 +32,17 @@ public class DepartmentController extends BaseController { ...@@ -21,5 +32,17 @@ public class DepartmentController extends BaseController {
@Autowired @Autowired
private DepartmentService departmentService; private DepartmentService departmentService;
@PostMapping(value = "/findList")
@ApiOperation(value = "条件分页查询企业审核信息")
public PageInfoResponse<EnterpriseAuditDto> findList(@RequestBody EnterpriseAuditRequest auditRequest, HttpServletRequest req) throws Exception {
PageInfoResponse<EnterpriseAuditDto> pageInfo = new PageInfoResponse<>();
try {
pageInfo = departmentService.findList(auditRequest, req);
}catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
} }
\ No newline at end of file
package com.jz.manage.moduls.controller.customer.bean.dto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/10
* @Version:
*/
@Api(tags = "企业审核信息返回参数")
public class EnterpriseAuditDto {
@ApiModelProperty(value = "企业id")
private Long departmentId;
@ApiModelProperty(value = "企业名称")
private String departmentName;
@ApiModelProperty(value = "联系人姓名")
private String customerName;
@ApiModelProperty(value = "联系人电话")
private String customerPhone;
@ApiModelProperty(value = "审核状态")
private String auditStatus;
@ApiModelProperty(value = "提交时间")
private Date creTime;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
public Long getDepartmentId() {
return departmentId;
}
public void setDepartmentId(Long departmentId) {
this.departmentId = departmentId;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public Date getAuditTime() {
return auditTime;
}
public void setAuditTime(Date auditTime) {
this.auditTime = auditTime;
}
}
package com.jz.manage.moduls.controller.customer.bean.request;
import com.jz.common.bean.BasePageBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName:
* @Author: Carl
* @Date: 2020/12/10
* @Version:
*/
@Api(tags = "企业审核信息请求参数封装")
public class EnterpriseAuditRequest extends BasePageBean {
@ApiModelProperty(value = "企业地址")
private String registeredAddress;
@ApiModelProperty(value = "企业名称")
private String departmentName;
@ApiModelProperty(value = "联系人电话")
private String customerPhone;
@ApiModelProperty(value = "审核状态")
private String auditStatus;
public String getRegisteredAddress() {
return registeredAddress;
}
public void setRegisteredAddress(String registeredAddress) {
this.registeredAddress = registeredAddress;
}
public String getDepartmentName() {
return departmentName;
}
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
public String getCustomerPhone() {
return customerPhone;
}
public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
}
...@@ -2,6 +2,10 @@ package com.jz.manage.moduls.mapper; ...@@ -2,6 +2,10 @@ package com.jz.manage.moduls.mapper;
import com.jz.common.base.BaseMapper; import com.jz.common.base.BaseMapper;
import com.jz.common.entity.Department; import com.jz.common.entity.Department;
import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import java.util.List;
import java.util.Map;
/** /**
* 企业(TDepartment)表数据库访问层 * 企业(TDepartment)表数据库访问层
...@@ -11,4 +15,10 @@ import com.jz.common.entity.Department; ...@@ -11,4 +15,10 @@ import com.jz.common.entity.Department;
*/ */
public interface DepartmentDao extends BaseMapper<Department> { public interface DepartmentDao extends BaseMapper<Department> {
/**
* 条件分页查询企业审核信息表
* @param param
* @return
*/
List<EnterpriseAuditDto> findList(Map<String, Object> param);
} }
\ No newline at end of file
package com.jz.manage.moduls.service; package com.jz.manage.moduls.service;
import com.jz.common.bean.PageInfoResponse;
import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import javax.servlet.http.HttpServletRequest;
/** /**
* 企业(TDepartment)表服务接口 * 企业(TDepartment)表服务接口
* *
...@@ -9,4 +15,11 @@ package com.jz.manage.moduls.service; ...@@ -9,4 +15,11 @@ package com.jz.manage.moduls.service;
public interface DepartmentService { public interface DepartmentService {
/**
* 条件查询企业审核信息列表
* @param auditRequest
* @param req
* @return
*/
PageInfoResponse<EnterpriseAuditDto> findList(EnterpriseAuditRequest auditRequest, HttpServletRequest req);
} }
\ No newline at end of file
package com.jz.manage.moduls.service.impl; package com.jz.manage.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto;
import com.jz.manage.moduls.controller.customer.bean.request.EnterpriseAuditRequest;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.mapper.DepartmentDao; import com.jz.manage.moduls.mapper.DepartmentDao;
import com.jz.manage.moduls.service.DepartmentService; import com.jz.manage.moduls.service.DepartmentService;
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 org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* 企业(TDepartment)表服务实现类 * 企业(TDepartment)表服务实现类
...@@ -15,4 +28,45 @@ import org.springframework.stereotype.Service; ...@@ -15,4 +28,45 @@ import org.springframework.stereotype.Service;
public class DepartmentServiceImpl implements DepartmentService { public class DepartmentServiceImpl implements DepartmentService {
@Autowired @Autowired
private DepartmentDao tDepartmentDao; private DepartmentDao tDepartmentDao;
/**
* 条件查询企业审核信息列表
*
* @param auditRequest
* @param req
* @return
*/
@Override
public PageInfoResponse<EnterpriseAuditDto> findList(EnterpriseAuditRequest auditRequest, HttpServletRequest req) {
PageInfoResponse<EnterpriseAuditDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
// 企业地址
if (!StringUtils.isEmpty(auditRequest.getRegisteredAddress())) {
param.put("registeredAddress", auditRequest.getRegisteredAddress());
}
// 企业名
if (!StringUtils.isEmpty(auditRequest.getDepartmentName())) {
param.put("departmentName", auditRequest.getDepartmentName());
}
// 联系人电话
if (auditRequest.getCustomerPhone() != null) {
param.put("customerPhone", auditRequest.getCustomerPhone());
}
// 审核状态
if (!StringUtils.isEmpty(auditRequest.getAuditStatus())) {
param.put("auditStatus", auditRequest.getAuditStatus());
}
PageHelper.startPage(auditRequest.getPageNum(), auditRequest.getPageSize());
List<EnterpriseAuditDto> list = tDepartmentDao.findList(param);
PageInfo<EnterpriseAuditDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
} }
\ No newline at end of file
...@@ -282,4 +282,33 @@ ...@@ -282,4 +282,33 @@
delete from t_department where department_id = #{departmentId} delete from t_department where department_id = #{departmentId}
</delete> </delete>
<select id="findList" parameterType="map" resultType="com.jz.manage.moduls.controller.customer.bean.dto.EnterpriseAuditDto">
SELECT
t1.department_id as departmentId,
t1.department_name as departmentName,
t2.customer_name as customerName,
t2.customer_phone as customerPhone,
(CASE WHEN t1.audit_status = '01' THEN '待审核' WHEN t1.audit_status = '02' THEN '已审核' WHEN t1.audit_status = '03' THEN '未通过' end) as auditStatus,
t1.cre_time as creTime,
t1.audit_time as auditTime
FROM
t_department t1
INNER JOIN
t_mall_customer t2 ON t1.department_id = t2.department_id
WHERE
1= 1 and
t1.del_flag = 'N' and
<if test="registeredAddress != null and registeredAddress != ''">
and t1.registered_address like concat('%',#{registeredAddress},'%')
</if>
<if test="departmentName != null and departmentName != ''">
and t1.department_name like concat('%',#{departmentName},'%')
</if>
<if test="customerPhone != null and customerPhone != ''">
and t2.customer_phone = #{customerPhone}
</if>
<if test="auditStatus != null and auditStatus != ''">
and t1.audit_status = #{auditStatus}
</if>
</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