Commit 5db9ab86 authored by chenyuefang's avatar chenyuefang

供应商分类列表

parent 47e4322f
......@@ -167,6 +167,7 @@ tenant:
- d_project
- d_subcontract
- dim_area
- biz_dict_data
# MyBatisPlus配置
......
package com.dsk.cscec.controller;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.R;
import com.dsk.cscec.domain.TreeSelect;
import com.dsk.cscec.domain.bo.BizDictDataBo;
import com.dsk.cscec.service.IBizDictDataService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 字典相关
*
* @author
* @since 2023-12-10
*/
@RequiredArgsConstructor
@RestController
@RequestMapping("/bizDictData")
public class BizDictDataController extends BaseController {
/**
* 服务对象
*/
private final IBizDictDataService iBizDictDataService;
/**
* 查询业务数据字典树形列表
*
* @return
*/
@GetMapping("/tree")
public R<List<TreeSelect>> tree(@Validated BizDictDataBo bo) {
return R.ok(iBizDictDataService.buildDeptTreeSelect(bo));
}
}
package com.dsk.cscec.controller;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo;
import com.dsk.cscec.service.ICustomerInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* 供应商相关
*
* @author
* @since 2023-12-10
*/
@RequiredArgsConstructor
@RestController
@RequestMapping("/customerInfo")
public class CustomerInfoController extends BaseController {
/**
* 服务对象
*/
private final ICustomerInfoService iCustomerInfoService;
/**
* 供应商分类列表
*/
@PostMapping("/list")
public TableDataInfo<CustomerInfoVo> list(@Validated @RequestBody CustomerInfoBo bo,@RequestBody PageQuery query) {
return iCustomerInfoService.queryPageList(bo, query);
}
}
package com.dsk.cscec.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 业务数据字典对象 biz_dict_data
*
* @author ruoyi
* @date 2021-11-08
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("biz_dict_data")
public class BizDictData implements Serializable {
private static final long serialVersionUID=1L;
/**
* 编码
*/
@TableId(value = "id")
private String id;
private String ancestors;
/**
* 字典编码
*/
private String code;
/**
* 字典名称
*/
private String name;
/**
* 系统字典表 biz_dict_data_type
*/
private String type;
/**
* 字典父级id
*/
private String parentId;
@TableField(exist = false)
private String parentName;
/**
* 备注
*/
private String remark;
/**
* 删除标志(0代表存在 2代表删除)
*/
@TableLogic
private String delFlag;
@TableField(exist = false)
private List<BizDictData> children = new ArrayList<BizDictData>();
}
package com.dsk.cscec.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect树结构实体类
*
* @author ruoyi
*/
@Data
@NoArgsConstructor
@Accessors(chain = true)
public class TreeSelect implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 节点ID
*/
private String id;
/**
* 节点名称
*/
private String label;
/**
* 子节点
*/
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<TreeSelect> children;
public TreeSelect(BizDictData dept) {
this.id = dept.getId();
this.label = dept.getName();
this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
}
}
package com.dsk.cscec.domain.bo;
import com.dsk.common.core.domain.BaseEntity;
import com.dsk.common.core.validate.AddGroup;
import com.dsk.common.core.validate.EditGroup;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* 业务数据字典业务对象 biz_dict_data
*
* @author ruoyi
* @date 2021-11-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class BizDictDataBo extends BaseEntity {
/**
* 编码
*/
@NotNull(message = "编码不能为空", groups = { EditGroup.class })
private String id;
/**
* 字典编码
*/
private String code;
/**
* 字典名称
*/
@NotBlank(message = "字典名称不能为空", groups = { AddGroup.class, EditGroup.class })
private String name;
/**
* 系统字典表 biz_dict_data_type
*/
@NotBlank(message = "系统字典表 biz_dict_data_type不能为空", groups = { AddGroup.class, EditGroup.class })
private String type;
/**
* 字典父级id
*/
@NotNull(message = "字典父级id不能为空", groups = { AddGroup.class, EditGroup.class })
private String parentId;
/**
* 分页大小
*/
private Integer pageSize;
/**
* 当前页数
*/
private Integer pageNum;
/**
* 排序列
*/
private String orderByColumn;
/**
* 排序的方向desc或者asc
*/
private String isAsc;
/**
* 祖级列表
*/
private String ancestors;
}
package com.dsk.cscec.domain.bo;
import com.dsk.common.core.domain.BaseEntity;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
import java.util.List;
/**
* 供应商分类查询
*
* @author
* @since 2023-12-10
*/
@Data
public class CustomerInfoBo extends BaseEntity {
/**
* 供应商类别(分供,劳务分包,专业分包,租赁,劳务分包队伍)
*/
@NotEmpty(message = "供应商类别不能为空")
private String customerClass;
/**
* 劳务队伍标志(Y N)
*/
private String serviceTeamLogo;
/**
* 供应商名称
*/
private String customerName;
/**
* 注册地区域(东北地区,华东地区,华中地区,华北地区,华南地区,西北地区,西南地区)
*/
private List<String> registerRegion;
/**
* 省份
*/
private List<String> registerProvince;
/**
* 城市
*/
private List<String> registerCity;
/**
* 供应商状态(不合格,优质,合格,移出,预警)
*/
private List<String> customerState;
/**
* 资质等级(一级,二级,三级,不分等级,特级)
*/
private List<String> credential;
/**
* 专业类别id
*/
private List<String> groupSpecialtyId;
/**
* 集团专业类别
*/
private String groupSpecialty;
/**
* 考评等级(A,B,C,Z)
*/
private List<String> creditLevel;
/**
* 纳税人身份(一般纳税人,小规模纳税人)
*/
private List<String> paytaxType;
/**
* 纳税人税率(免税,3%,6%,11%,17%)
*/
private List<String> taxRate;
/**
* 准入时间开始
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date approveDate2Start;
/**
* 准入时间结束
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date approveDate2End;
/**
* 队长名称
*/
private String leaderName;
}
package com.dsk.cscec.domain.vo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import lombok.Data;
import java.util.Date;
/**
* 供应商分类查询
*
* @author
* @since 2023-12-10
*/
@Data
@ExcelIgnoreUnannotated
public class CustomerInfoVo {
private static final long serialVersionUID = 1L;
/**
* 客商主键
*/
private Long customerKey;
/**
* ipm供应商id
*/
private String customerId;
/**
* 供应商编号
*/
private String customerCode;
/**
* 供应商名称
*/
private String customerName;
/**
* 供应商状态
*/
private String customerState;
/**
* 推荐公司ID
*/
private String recommendOrgId;
/**
* 推荐公司
*/
private String recommendOrg;
/**
* 注册地区域
*/
private String registerRegion;
/**
* 省份
*/
private String registerProvince;
/**
* 城市
*/
private String registerCity;
/**
* 集团专业类别
*/
private String groupSpecialty;
/**
* 法人代表
*/
private String representative;
/**
* 纳税人身份
*/
private String paytaxType;
/**
* 纳税人税率
*/
private String taxRate;
/**
* 施工承包范围
*/
private String constructJobScope;
/**
* 资质等级
*/
private String credential;
/**
* 注册资金
*/
private Double registerCapital;
/**
* 联系人
*/
private String contactPerson;
/**
* 联系人电话
*/
private String contactPhone;
/**
* 准入时间
*/
private Date approveDate2;
/**
* 供应商类别
*/
private String customerClass;
/**
* 考评等级
*/
private String creditLevel;
/**
* 二级市场企业编码
*/
private String secondaryCode;
/**
* 统一社会信用代码/营业执照号码
*/
private String unifySocialCode;
/**
* 队长名称
*/
private String leaderName;
/**
* 劳务队长身份证号
*/
private String laborCaptainIdcard;
/**
* 劳务队长联系电话
*/
private String laborCaptainPhone;
/**
* 队伍规模人数
*/
private Double serviceTeamPersonnum;
/**
* 专业特长
*/
private String serviceTeamSpeciality;
/**
* 公司合作数量
*/
private Integer enterpriseCooperationCount;
/**
* 合作项目数量
*/
private Integer projectCooperationCount;
/**
* 资源平台分类
*/
}
package com.dsk.cscec.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.cscec.domain.BizDictData;
import com.dsk.cscec.domain.bo.BizDictDataBo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 业务数据字典Mapper接口
*
* @author ruoyi
* @date 2021-11-08
*/
public interface BizDictDataMapper extends BaseMapper<BizDictData> {
public List<Long> findIdByName(String name);
BizDictData findByNameAndType(@Param("name") String name, @Param("type") String type);
int countByName(@Param("name") String name, @Param("type") String type);
List<BizDictData> exportListVo(@Param("bo") BizDictDataBo bo);
/**
* 根据ID查询相关数据
*
* @param id
* @return 查询到的数据
*/
BizDictData queryByID(Long id);
}
......@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.bo.DCustomerSearchBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -20,5 +22,13 @@ public interface DCustomerMapper extends BaseMapper<DCustomer> {
Page<DCustomer> allSearchList(IPage<DCustomerSearchBo> build, @Param("bo") DCustomerSearchBo bo);
/**
* 分类查询供应商列表
* @param build
* @param bo
* @return
*/
Page<CustomerInfoVo> queryListByType(IPage<CustomerInfoBo> build, @Param("bo") CustomerInfoBo bo);
}
package com.dsk.cscec.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.BizDictData;
import com.dsk.cscec.domain.TreeSelect;
import com.dsk.cscec.domain.bo.BizDictDataBo;
import java.util.List;
/**
* 业务数据字典Service接口
*
* @author ruoyi
* @date 2021-11-08
*/
public interface IBizDictDataService extends IService<BizDictData> {
/**
* 查询单个
*
* @return
*/
BizDictData queryById(Long id);
/**
* 查询列表
*/
TableDataInfo<BizDictData> queryPageList(BizDictDataBo bo, PageQuery query);
/**
* 查询列表
*/
List<BizDictData> queryList(BizDictDataBo bo);
String importDict(List<BizDictData> dictList, String type, String operName);
List<TreeSelect> buildDeptTreeSelect(BizDictDataBo bo);
}
package com.dsk.cscec.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo;
/**
* 组织维表(DCustomer)表服务接口
*
* @author
* @since 2023-12-10
*/
public interface ICustomerInfoService extends IService<DCustomer> {
TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query);
}
package com.dsk.cscec.service.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.common.exception.ServiceException;
import com.dsk.common.utils.StringUtils;
import com.dsk.cscec.domain.BizDictData;
import com.dsk.cscec.domain.TreeSelect;
import com.dsk.cscec.domain.bo.BizDictDataBo;
import com.dsk.cscec.mapper.BizDictDataMapper;
import com.dsk.cscec.service.IBizDictDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 业务数据字典Service业务层处理
*
* @author ruoyi
* @date 2021-11-08
*/
@Slf4j
@Service
public class BizDictDataServiceImpl extends ServiceImpl<BizDictDataMapper, BizDictData> implements IBizDictDataService {
@Override
public BizDictData queryById(Long id) {
return baseMapper.queryByID(id);
}
@Override
public TableDataInfo<BizDictData> queryPageList(BizDictDataBo bo, PageQuery query) {
Page<BizDictData> result = baseMapper.selectPage(query.build(), buildQueryWrapper(bo));
return TableDataInfo.build(result);
}
@Override
public List<BizDictData> queryList(BizDictDataBo bo) {
return baseMapper.selectList(buildQueryWrapper(bo));
}
private LambdaQueryWrapper<BizDictData> buildQueryWrapper(BizDictDataBo bo) {
Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<BizDictData> lqw = Wrappers.lambdaQuery();
lqw.like(StringUtils.isNotBlank(bo.getCode()), BizDictData::getCode, bo.getCode());
lqw.like(StringUtils.isNotBlank(bo.getName()), BizDictData::getName, bo.getName());
lqw.eq(StringUtils.isNotBlank(bo.getType()), BizDictData::getType, bo.getType());
lqw.eq(bo.getParentId() != null, BizDictData::getParentId, bo.getParentId());
return lqw;
}
/**
* 保存前的数据校验
*
* @param entity 实体类数据
*/
private void validEntityBeforeSave(BizDictData entity) {
//TODO 做一些数据校验,如唯一约束
//code唯一校验
if (StringUtils.isNotBlank(entity.getCode())) {
LambdaQueryWrapper<BizDictData> lqw = Wrappers.lambdaQuery();
lqw.eq(BizDictData::getType, entity.getType());
lqw.eq(BizDictData::getCode, entity.getCode());
lqw.ne(ObjectUtil.isNotNull(entity.getId()), BizDictData::getId, entity.getId());
List<BizDictData> dictDataList = baseMapper.selectList(lqw);
if (CollectionUtils.isNotEmpty(dictDataList)) {
Assert.isTrue(false, "编码 " + entity.getCode() + " 已存在");
}
}
}
public List<BizDictData> buildDeptTree(List<BizDictData> depts) {
List<BizDictData> returnList = new ArrayList<BizDictData>();
List<String> tempList = new ArrayList<String>();
for (BizDictData dept : depts) {
tempList.add(dept.getId());
}
for (BizDictData dept : depts) {
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(dept.getParentId())) {
recursionFn(depts, dept);
returnList.add(dept);
}
}
if (returnList.isEmpty()) {
returnList = depts;
}
return returnList;
}
/**
* 递归列表
*/
private void recursionFn(List<BizDictData> list, BizDictData t) {
// 得到子节点列表
List<BizDictData> childList = getChildList(list, t);
t.setChildren(childList);
for (BizDictData tChild : childList) {
if (hasChild(list, tChild)) {
recursionFn(list, tChild);
}
}
}
/**
* 得到子节点列表
*/
private List<BizDictData> getChildList(List<BizDictData> list, BizDictData t) {
List<BizDictData> tlist = new ArrayList<BizDictData>();
for (BizDictData n : list) {
if (ObjectUtil.isNotNull(n.getParentId()) && n.getParentId().equals(t.getId())) {
tlist.add(n);
}
}
return tlist;
}
/**
* 判断是否有子节点
*/
private boolean hasChild(List<BizDictData> list, BizDictData t) {
return getChildList(list, t).size() > 0;
}
@Override
public String importDict(List<BizDictData> dictList, String type, String operName) {
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (BizDictData dictData : dictList) {
try {
Assert.notNull(dictData.getName(), "字典名称不能为空");
dictData.setType(type);
//查询编码是否重复
validEntityBeforeSave(dictData);
//查询名称是否重复
Assert.isFalse(baseMapper.countByName(dictData.getName(), type) != 0, "字典名称已存在");
//查询是否有父级
if (StrUtil.isNotBlank(dictData.getParentName())) {
BizDictData bizDictData = baseMapper.findByNameAndType(dictData.getParentName(), type);
if (bizDictData != null) {
dictData.setParentId(bizDictData.getId());
dictData.setAncestors(bizDictData.getAncestors() + "," + bizDictData.getId());
} else {
// bizDictData = new BizDictData();
// bizDictData.setName(dictData.getParentName());
// bizDictData.setType(type);
// this.save(bizDictData);
// dictData.setParentId(bizDictData.getId());
Assert.isTrue(false, "父级 " + dictData.getParentName() + " 不存在");
}
} else {
dictData.setParentId("0");
}
this.save(dictData);
successNum++;
successMsg.append("<br/>" + successNum + "、字典 " + dictData.getName() + " 导入成功");
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、字典 " + dictData.getName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error("BizDictDataServiceImpl.importDict() error:" + msg, e);
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
@Override
public List<TreeSelect> buildDeptTreeSelect(BizDictDataBo bo) {
List<BizDictData> list = baseMapper.selectList(buildQueryWrapper(bo));
List<BizDictData> deptTrees = buildDeptTree(list);
return deptTrees.stream().map(TreeSelect::new).collect(Collectors.toList());
}
}
package com.dsk.cscec.service.impl;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo;
import com.dsk.cscec.mapper.DCustomerMapper;
import com.dsk.cscec.mapper.DSubcontractMapper;
import com.dsk.cscec.service.ICustomerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 组织维表(DCustomer)表服务实现类
*
* @author
* @since 2023-12-10
*/
@Service
public class CustomerInfoServiceImpl extends ServiceImpl<DCustomerMapper, DCustomer> implements ICustomerInfoService {
@Autowired
private DSubcontractMapper subcontractMapper;
@Override
public TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query) {
if("劳务分包".equals(bo.getCustomerClass())){
bo.setServiceTeamLogo("N");
}
if("劳务分包队伍".equals(bo.getCustomerClass())){
bo.setCustomerClass("劳务分包");
bo.setServiceTeamLogo("Y");
}
Page<CustomerInfoVo> page = baseMapper.queryListByType(query.build(), bo);
if (CollectionUtils.isNotEmpty(page.getRecords())) {
for (CustomerInfoVo customerInfoVo : page.getRecords()) {
//公司合作数量
customerInfoVo.setEnterpriseCooperationCount(subcontractMapper.selectEnterpriseCountByCustomerId(customerInfoVo.getCustomerId()));
//项目合作数量
customerInfoVo.setProjectCooperationCount(subcontractMapper.selectProjectCountByCustomerId(customerInfoVo.getCustomerId()));
}
}
return TableDataInfo.build(page);
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dsk.cscec.mapper.BizDictDataMapper">
<resultMap type="com.dsk.cscec.domain.BizDictData" id="BizDictDataResult">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="parentId" column="parent_id"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="Base_Column_List">
id,code,name,type,parent_id,remark
</sql>
<select id="findIdByName" resultType="java.lang.Long">
select id from biz_dict_data where `name` like concat('%',#{name},'%')
</select>
<select id="findByNameAndType" resultType="com.dsk.cscec.domain.BizDictData">
select id,name,code,ancestors from biz_dict_data
where `name` = #{name}
and type = #{type}
and del_flag = 0
</select>
<select id="countByName" resultType="java.lang.Integer">
SELECT
count( id )
FROM
biz_dict_data
WHERE
del_flag = 0
<if test="type != null and type != ''">
AND `type` = #{type}
</if>
AND `name` = #{name}
</select>
<select id="exportListVo" resultType="com.dsk.cscec.domain.BizDictData">
select t.id,t.name,t.parent_id,t1.name parentName, t.unit,t.remark,t.code,t.feature from biz_dict_data t
left join biz_dict_data t1 on t.parent_id=t1.id
where
t.del_flag=0
and t.`type`=#{bo.type}
<if test="bo.name != null and bo.name != ''">
and (t.name like concat('%',#{bo.name},'%') or t1.name like concat('%',#{bo.name},'%'))
</if>
</select>
<select id="queryByID" resultType="com.dsk.cscec.domain.BizDictData">
select <include refid="Base_Column_List"/>
from biz_dict_data where del_flag = 0
and id = #{id}
</select>
</mapper>
......@@ -73,4 +73,119 @@
order by approve_date2 desc
</select>
<sql id="allColumn">
customer_key, customer_id, cusomer_name, fin_customer_code, fin_customer_name, tax_number, isvalid, customer_code,
customer_name, customer_state, recommend_org_id, recommend_org, approve_date2, version, supplier_id, customer_category_code,
representative, register_no, unify_social_code, business_license, orgnization_code, register_capital, primary_business,
credential, brand, address, register_city_id, register_region, register_province, register_city, open_bank, bank_account,
contact_person, contact_phone, mobile, zipcode, email, website, remark, area_code, currency, orgnization_id, customer_type,
credit_situation, employee_id, establish_date, phone_code, customer_property, sector_position, scope, fax, customer_class,
id_card, sub_company, allied_company, turn_over, main_customer, main_resource, main_region, raw_material, productline,
customer_category_type, customer_firm, customertype_id, customer_category_type_id, register_address, warehouse_address,
teamwork_product, isfactoryorfranchise, expire_date1, expire_date2, expire_date3, expire_date4, expire_date5, leader_name,
group_specialty_id, group_specialty, manage_ability, product_quality_ability, construct_job_scope, responsible_person,
approve_date1, isagree, business_manager, project_manager, purchase_principal, upper_company_code, service_team_logo,
labor_captain_idcard, labor_captain_phone, service_team_personnum, service_team_speciality, secondary_code, approve_date3,
approve_date4, flow_state, isenterbjlaborcomany, expire_date6, expire_date7, credit_level, base_logo, recommend_project,
recommend_project_id, recommend_date, aptitude_card, work_safety_license, master_id, paytax_type, tax_rate, card_type,
customer_score, customer_name2, customer_name3, customer_name4, country, fin_customer_type, company_code, owner_kind,
customer_kind, data_source, isowner, iscustomer, abbr_name1, abbr_name2, tax_type, isfreeze, update_date, load_time
</sql>
<sql id="columnByType">
customer_key, customer_id, customer_code, customer_name, customer_state, recommend_org_id, recommend_org,
register_region,register_province,register_city,group_specialty,representative,paytax_type,tax_rate,
construct_job_scope,credential,register_capital,contact_person,contact_phone,approve_date2,credit_level,
secondary_code,unify_social_code,primary_business,leader_name,labor_captain_phone,labor_captain_idcard,
service_team_personnum,service_team_speciality
</sql>
<select id="queryListByType" resultType="com.dsk.cscec.domain.vo.CustomerInfoVo">
select
<include refid="columnByType"></include>
from d_customer
where
recommend_org_id = 'F17305B4EA4444CBAB12892C7B99E475'
<if test="bo.customerClass != null and bo.customerClass != ''">
and customer_class = #{bo.customerClass}
</if>
<if test="bo.serviceTeamLogo != null and bo.serviceTeamLogo == 'Y'.toString()">
and leader_name is not null
</if>
<if test="bo.serviceTeamLogo != null and bo.serviceTeamLogo == 'N'.toString()">
and leader_name is null
</if>
<if test="bo.leaderName != null and bo.leaderName != ''">
and leader_name like concat('%',#{bo.leaderName},'%')
</if>
<if test="bo.customerName != null and bo.customerName != '' ">
and customer_name like concat('%',#{bo.customerName},'%')
</if>
<if test="bo.registerProvince != null and bo.registerCity == null">
and register_province in
<foreach collection="bo.registerProvince" item="registerProvince" separator="," open="(" close=")">
#{registerProvince}
</foreach>
</if>
<if test="bo.registerProvince == null and bo.registerCity != null ">
and register_city in
<foreach collection="bo.registerCity" item="registerCity" separator="," open="(" close=")">
#{registerCity}
</foreach>
</if>
<if test="bo.registerProvince != null and bo.registerCity != null ">
and (
register_province in
<foreach collection="bo.registerProvince" item="registerProvince" separator="," open="(" close=")">
#{registerProvince}
</foreach>
or register_city in
<foreach collection="bo.registerCity" item="registerCity" separator="," open="(" close=")">
#{registerCity}
</foreach>
)
</if>
<if test="bo.groupSpecialtyId != null ">
<foreach collection="bo.groupSpecialtyId" item="groupSpecialtyId">
and find_in_set(#{groupSpecialtyId},group_specialty_id) > 0
</foreach>
</if>
<if test="bo.customerState != null ">
and customer_state in
<foreach collection="bo.customerState" item="customerState" separator="," open="(" close=")">
#{customerState}
</foreach>
</if>
<if test="bo.credential != null ">
and credential in
<foreach collection="bo.credential" item="credential" separator="," open="(" close=")">
#{credential}
</foreach>
</if>
<if test="bo.creditLevel != null ">
and credit_level in
<foreach collection="bo.creditLevel" item="creditLevel" separator="," open="(" close=")">
#{creditLevel}
</foreach>
</if>
<if test="bo.paytaxType != null">
and paytax_type in
<foreach collection="bo.paytaxType" item="paytaxType" separator="," open="(" close=")">
#{paytaxType}
</foreach>
</if>
<if test="bo.taxRate != null">
and tax_rate in
<foreach collection="bo.taxRate" item="taxRate" separator="," open="(" close=")">
#{taxRate}
</foreach>
</if>
<if test="bo.approveDate2Start != null">
and approve_date2 &gt;= #{bo.approveDate2Start}
</if>
<if test="bo.approveDate2End != null">
and date(approve_date2) &lt;= #{bo.approveDate2End}
</if>
order by approve_date2 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