u
This commit is contained in:
1 parent
8a25c14a1b
commit
7cd7bbd166
34 files changed
+516
-227
No files matched your search
@@ -44,6 +44,7 @@
|
||||
|
||||
ORDER BY b_name ASC
|
||||
</select>
|
||||
|
||||
<select id="getShiVisibleList" resultType="cn.link56.domain.vo.company.CompanyRecommendVO">
|
||||
SELECT
|
||||
shi.b_name AS shiName,
|
||||
|
||||
+12
-12
@@ -9,11 +9,11 @@ import cn.link56.auth.identity.model.vo.AuthLoginVO;
|
||||
import cn.link56.auth.token.model.AuthToken;
|
||||
import cn.link56.auth.token.model.TokenPayload;
|
||||
import cn.link56.auth.token.service.AuthTokenService;
|
||||
import cn.link56.entity.BCompany;
|
||||
import cn.link56.entity.BCompanyUser;
|
||||
import cn.link56.company.model.po.CompanyPO;
|
||||
import cn.link56.company.model.po.CompanyUserPO;
|
||||
import cn.link56.auth.identity.model.dto.AuthRegisterDTO;
|
||||
import cn.link56.base.service.BCompanyService;
|
||||
import cn.link56.base.service.BCompanyUserService;
|
||||
import cn.link56.company.service.CompanyService;
|
||||
import cn.link56.company.service.CompanyUserService;
|
||||
import cn.link56.common.exception.BusinessException;
|
||||
import cn.link56.common.utils.snowflake.idgen.IdGenerator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -25,9 +25,9 @@ import javax.annotation.Resource;
|
||||
@Service
|
||||
public class AuthIdentityService {
|
||||
@Resource
|
||||
private BCompanyService companyService;
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private BCompanyUserService companyUserService;
|
||||
private CompanyUserService companyUserService;
|
||||
@Resource
|
||||
private AuthTokenService tokenService;
|
||||
@Resource
|
||||
@@ -57,7 +57,7 @@ public class AuthIdentityService {
|
||||
long companyId = IdGenerator.nextId();
|
||||
|
||||
companyService.save(
|
||||
new BCompany()
|
||||
new CompanyPO()
|
||||
.setId(companyId)
|
||||
.setName(company.getName())
|
||||
.setIndustry(company.getIndustry())
|
||||
@@ -68,7 +68,7 @@ public class AuthIdentityService {
|
||||
);
|
||||
|
||||
companyUserService.save(
|
||||
new BCompanyUser()
|
||||
new CompanyUserPO()
|
||||
.setId(IdGenerator.nextId())
|
||||
.setCompanyId(companyId)
|
||||
.setName(admin.getName())
|
||||
@@ -81,7 +81,7 @@ public class AuthIdentityService {
|
||||
}
|
||||
|
||||
public AuthLoginVO loginByPassword(AuthLoginPasswordDTO dto) {
|
||||
BCompanyUser user = companyUserService.loginByEmailAndPassword(dto.getEmail(), dto.getPassword());
|
||||
CompanyUserPO user = companyUserService.loginByEmailAndPassword(dto.getEmail(), dto.getPassword());
|
||||
if (user == null) {
|
||||
throw new BusinessException("邮箱或密码错误");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class AuthIdentityService {
|
||||
throw new BusinessException("邮箱或验证码失效");
|
||||
}
|
||||
|
||||
BCompanyUser user = companyUserService.loginByEmail(email);
|
||||
CompanyUserPO user = companyUserService.loginByEmail(email);
|
||||
if (user == null) {
|
||||
throw new BusinessException("邮箱不存在");
|
||||
}
|
||||
@@ -114,8 +114,8 @@ public class AuthIdentityService {
|
||||
/**
|
||||
* 公共逻辑:根据用户生成 LoginVO
|
||||
*/
|
||||
private AuthLoginVO buildLoginVO(BCompanyUser user) {
|
||||
BCompany company = companyService.getById(user.getCompanyId());
|
||||
private AuthLoginVO buildLoginVO(CompanyUserPO user) {
|
||||
CompanyPO company = companyService.getById(user.getCompanyId());
|
||||
AuthToken authToken = tokenService.generateToken(new TokenPayload(user.getCompanyId(), user.getId()));
|
||||
|
||||
return new AuthLoginVO(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package cn.link56.base.mapper;
|
||||
|
||||
import cn.link56.entity.BArea;
|
||||
import cn.link56.base.model.po.AreaPO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
@@ -11,5 +11,5 @@ public interface AreaMapper {
|
||||
* 获取所有区域信息
|
||||
* @return 区域集合
|
||||
*/
|
||||
List<BArea> listAllArea();
|
||||
List<AreaPO> listAllArea();
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.link56.base.mapper;
|
||||
|
||||
import cn.link56.entity.BCompany;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BCompanyMapper extends BaseMapper<BCompany> {
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package cn.link56.base.mapper;
|
||||
|
||||
import cn.link56.entity.BCompanyUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BCompanyUserMapper extends BaseMapper<BCompanyUser> {
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package cn.link56.base.mapper;
|
||||
|
||||
import cn.link56.entity.BIndustry;
|
||||
import cn.link56.base.model.po.IndustryPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface IndustryMapper extends BaseMapper<BIndustry> {
|
||||
public interface IndustryMapper extends BaseMapper<IndustryPO> {
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package cn.link56.entity;
|
||||
package cn.link56.base.model.po;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@@ -7,7 +7,7 @@ import lombok.NoArgsConstructor;
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class BArea {
|
||||
public class AreaPO {
|
||||
private String id;
|
||||
private Integer xh;
|
||||
private String name;
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package cn.link56.entity;
|
||||
package cn.link56.base.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
|
||||
@NoArgsConstructor
|
||||
@TableName("b_industry")
|
||||
@Accessors(chain = true)
|
||||
public class BIndustry {
|
||||
public class IndustryPO {
|
||||
@TableId(value = "b_id")
|
||||
private Long id;
|
||||
@TableField("b_xh")
|
||||
@@ -1,39 +0,0 @@
|
||||
package cn.link56.base.service;
|
||||
|
||||
import cn.link56.base.mapper.BCompanyMapper;
|
||||
import cn.link56.entity.BCompany;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class BCompanyService extends ServiceImpl<BCompanyMapper, BCompany> {
|
||||
@Resource
|
||||
private BCompanyMapper companyMapper;
|
||||
|
||||
/**
|
||||
* 检查公司名称是否重复
|
||||
*/
|
||||
public boolean isNameExists(String name) {
|
||||
Long count = companyMapper.selectCount(
|
||||
new LambdaQueryWrapper<BCompany>()
|
||||
.eq(BCompany::getName, name)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查公司手机号是否重复
|
||||
*/
|
||||
public boolean isPhoneExists(String phone) {
|
||||
Long count = companyMapper.selectCount(
|
||||
new LambdaQueryWrapper<BCompany>()
|
||||
.eq(BCompany::getPhone, phone)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
package cn.link56.base.service;
|
||||
|
||||
import cn.link56.base.mapper.BCompanyUserMapper;
|
||||
import cn.link56.entity.BCompanyUser;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class BCompanyUserService extends ServiceImpl<BCompanyUserMapper, BCompanyUser> {
|
||||
|
||||
@Resource
|
||||
private BCompanyUserMapper companyUserMapper;
|
||||
|
||||
/**
|
||||
* 判断邮箱是否重复
|
||||
* @param email 用户邮箱
|
||||
* @return true 表示邮箱已存在,false 表示可用
|
||||
*/
|
||||
public boolean isEmailExists(String email) {
|
||||
long count = companyUserMapper.selectCount(
|
||||
new LambdaQueryWrapper<BCompanyUser>()
|
||||
.eq(BCompanyUser::getEmail, email)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断手机号是否重复
|
||||
* @param phone 用户手机号
|
||||
* @return true 表示手机号已存在,false 表示可用
|
||||
*/
|
||||
public boolean isPhoneExists(String phone) {
|
||||
long count = companyUserMapper.selectCount(
|
||||
new LambdaQueryWrapper<BCompanyUser>()
|
||||
.eq(BCompanyUser::getPhone, phone)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
public BCompanyUser loginByEmailAndPassword(String email, String password){
|
||||
LambdaQueryWrapper<BCompanyUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BCompanyUser::getEmail,email)
|
||||
.eq(BCompanyUser::getPassword,password);
|
||||
|
||||
return companyUserMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
public BCompanyUser loginByEmail(String email){
|
||||
LambdaQueryWrapper<BCompanyUser> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BCompanyUser::getEmail,email);
|
||||
|
||||
return companyUserMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
+11
-11
@@ -2,8 +2,8 @@ package cn.link56.base.service;
|
||||
|
||||
import cn.link56.base.mapper.AreaMapper;
|
||||
import cn.link56.base.mapper.IndustryMapper;
|
||||
import cn.link56.entity.BArea;
|
||||
import cn.link56.entity.BIndustry;
|
||||
import cn.link56.base.model.po.AreaPO;
|
||||
import cn.link56.base.model.po.IndustryPO;
|
||||
import cn.link56.base.model.vo.BaseDataVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -15,17 +15,17 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class BaseDataService {
|
||||
@Resource
|
||||
private IndustryMapper industryMapper;
|
||||
private IndustryMapper IndustryMapper;
|
||||
@Resource
|
||||
private AreaMapper areaMapper;
|
||||
private AreaMapper AreaMapper;
|
||||
|
||||
public BaseDataVO getBaseData() {
|
||||
BaseDataVO baseDataVO = new BaseDataVO();
|
||||
|
||||
// 查询可用行业
|
||||
List<BaseDataVO.Industry> industries = industryMapper.selectList(
|
||||
new LambdaQueryWrapper<BIndustry>()
|
||||
.eq(BIndustry::getCanuse, "1")
|
||||
List<BaseDataVO.Industry> industries = IndustryMapper.selectList(
|
||||
new LambdaQueryWrapper<IndustryPO>()
|
||||
.eq(IndustryPO::getCanuse, "1")
|
||||
).stream()
|
||||
.map(industry -> new BaseDataVO.Industry(
|
||||
industry.getId(),
|
||||
@@ -37,7 +37,7 @@ public class BaseDataService {
|
||||
baseDataVO.setIndustries(industries);
|
||||
|
||||
// 地区
|
||||
List<BArea> allAreas = areaMapper.listAllArea();
|
||||
List<AreaPO> allAreas = AreaMapper.listAllArea();
|
||||
List<BaseDataVO.Area> areaTree = buildAreaTree(allAreas);
|
||||
|
||||
baseDataVO.setAreas(areaTree);
|
||||
@@ -47,7 +47,7 @@ public class BaseDataService {
|
||||
/**
|
||||
* BArea → BaseDataVO.Area 树
|
||||
*/
|
||||
private List<BaseDataVO.Area> buildAreaTree(List<BArea> areas) {
|
||||
private List<BaseDataVO.Area> buildAreaTree(List<AreaPO> areas) {
|
||||
if (areas == null || areas.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public class BaseDataService {
|
||||
Map<String, BaseDataVO.Area> map = new HashMap<>(areas.size());
|
||||
|
||||
// 1️⃣ 先全部转 VO
|
||||
for (BArea a : areas) {
|
||||
for (AreaPO a : areas) {
|
||||
BaseDataVO.Area vo = new BaseDataVO.Area(
|
||||
a.getId(),
|
||||
a.getXh(),
|
||||
@@ -72,7 +72,7 @@ public class BaseDataService {
|
||||
|
||||
for (BaseDataVO.Area area : map.values()) {
|
||||
String parentId = area.getFatherId();
|
||||
if (parentId == null || "0".equals(parentId)) {
|
||||
if (parentId == null || parentId.isEmpty()) {
|
||||
roots.add(area);
|
||||
} else {
|
||||
BaseDataVO.Area parent = map.get(parentId);
|
||||
|
||||
@@ -21,8 +21,8 @@ public class WebMvcConfig implements WebMvcConfigurer {
|
||||
"/auth/**",
|
||||
"/company/getCompanyPage",
|
||||
"/company/getPublicDetail",
|
||||
"/company/getRecommendList",
|
||||
"/company/getRecommendRightList",
|
||||
"/company/recommend",
|
||||
"/company/recommend/hot",
|
||||
|
||||
"/forum/post/page",
|
||||
"/forum/post/detail",
|
||||
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package cn.link56.company.controller;
|
||||
|
||||
import cn.link56.common.Result;
|
||||
import cn.link56.company.model.vo.RecommendCompanyVO;
|
||||
import cn.link56.company.model.vo.RecommendHotCompanyVO;
|
||||
import cn.link56.company.service.CompanyService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/company")
|
||||
public class CompanyController {
|
||||
@Resource
|
||||
private CompanyService companyService;
|
||||
|
||||
@GetMapping("/recommend")
|
||||
public Result<List<RecommendCompanyVO>> listRecommend(){
|
||||
List<RecommendCompanyVO> list = companyService.listRecommend();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/recommend/hot")
|
||||
public Result<List<RecommendHotCompanyVO>> listHot(){
|
||||
List<RecommendHotCompanyVO> list = companyService.listHot();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.link56.company.mapper;
|
||||
|
||||
import cn.link56.company.model.middle.RecommendCompanyRow;
|
||||
import cn.link56.company.model.po.CompanyPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyMapper extends BaseMapper<CompanyPO> {
|
||||
List<RecommendCompanyRow> listRecommend();
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package cn.link56.company.mapper;
|
||||
|
||||
import cn.link56.company.model.po.CompanyUserPO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface CompanyUserMapper extends BaseMapper<CompanyUserPO> {
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package cn.link56.company.model.middle;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecommendCompanyRow {
|
||||
private String shengName;
|
||||
private String shiName;
|
||||
|
||||
private Long companyId;
|
||||
private String companyName;
|
||||
private String color;
|
||||
}
|
||||
+5
-2
@@ -1,4 +1,4 @@
|
||||
package cn.link56.entity;
|
||||
package cn.link56.company.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
@@ -17,7 +17,7 @@ import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@TableName("b_company")
|
||||
@Accessors(chain = true)
|
||||
public class BCompany {
|
||||
public class CompanyPO {
|
||||
@TableId(value = "b_id")
|
||||
private Long id;
|
||||
|
||||
@@ -59,6 +59,9 @@ public class BCompany {
|
||||
@TableField("b_recommend")
|
||||
private String recommend;
|
||||
|
||||
@TableField("b_recommend_color")
|
||||
private String recommendColor;
|
||||
|
||||
@TableField("b_hot_recommend")
|
||||
private String hotRecommend;
|
||||
}
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
package cn.link56.entity;
|
||||
package cn.link56.company.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
@@ -17,7 +17,7 @@ import java.util.Date;
|
||||
@NoArgsConstructor
|
||||
@TableName("b_company_user")
|
||||
@Accessors(chain = true)
|
||||
public class BCompanyUser {
|
||||
public class CompanyUserPO {
|
||||
@TableId(value = "b_id")
|
||||
private Long id;
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package cn.link56.company.model.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecommendCompanyVO {
|
||||
private String shengName;
|
||||
private String shiName;
|
||||
private List<Company> companies;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class Company {
|
||||
private Long id;
|
||||
private String name;
|
||||
private String color;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package cn.link56.company.model.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecommendHotCompanyVO {
|
||||
private Long id;
|
||||
private String name;
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
package cn.link56.company.service;
|
||||
|
||||
import cn.link56.company.mapper.CompanyMapper;
|
||||
import cn.link56.company.model.middle.RecommendCompanyRow;
|
||||
import cn.link56.company.model.po.CompanyPO;
|
||||
import cn.link56.company.model.vo.RecommendCompanyVO;
|
||||
import cn.link56.company.model.vo.RecommendHotCompanyVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class CompanyService extends ServiceImpl<CompanyMapper,CompanyPO> {
|
||||
@Resource
|
||||
private CompanyMapper companyMapper;
|
||||
|
||||
public List<RecommendCompanyVO> listRecommend() {
|
||||
List<RecommendCompanyRow> rows = companyMapper.listRecommend();
|
||||
|
||||
return rows.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
row -> row.getShengName() + "_" + row.getShiName()
|
||||
))
|
||||
.values()
|
||||
.stream()
|
||||
.map(group -> {
|
||||
RecommendCompanyRow first = group.get(0);
|
||||
|
||||
List<RecommendCompanyVO.Company> companies = group.stream()
|
||||
.filter(r -> r.getCompanyId() != null)
|
||||
.map(r -> new RecommendCompanyVO.Company(
|
||||
r.getCompanyId(),
|
||||
r.getCompanyName(),
|
||||
r.getColor()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new RecommendCompanyVO(
|
||||
first.getShengName(),
|
||||
first.getShiName(),
|
||||
companies
|
||||
);
|
||||
})
|
||||
.filter(vo -> vo.getCompanies() != null && !vo.getCompanies().isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<RecommendHotCompanyVO> listHot() {
|
||||
LambdaQueryWrapper<CompanyPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CompanyPO::getHotRecommend, "1")
|
||||
.select(CompanyPO::getId, CompanyPO::getName);
|
||||
|
||||
return companyMapper.selectList(queryWrapper)
|
||||
.stream()
|
||||
.map(company -> new RecommendHotCompanyVO(
|
||||
company.getId(),
|
||||
company.getName()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查公司名称是否重复
|
||||
*/
|
||||
public boolean isNameExists(String name) {
|
||||
Long count = companyMapper.selectCount(
|
||||
new LambdaQueryWrapper<CompanyPO>()
|
||||
.eq(CompanyPO::getName, name)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查公司手机号是否重复
|
||||
*/
|
||||
public boolean isPhoneExists(String phone) {
|
||||
Long count = companyMapper.selectCount(
|
||||
new LambdaQueryWrapper<CompanyPO>()
|
||||
.eq(CompanyPO::getPhone, phone)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package cn.link56.company.service;
|
||||
|
||||
import cn.link56.company.mapper.CompanyUserMapper;
|
||||
import cn.link56.company.model.po.CompanyUserPO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
public class CompanyUserService extends ServiceImpl<CompanyUserMapper, CompanyUserPO> {
|
||||
|
||||
@Resource
|
||||
private CompanyUserMapper companyUserMapper;
|
||||
|
||||
/**
|
||||
* 判断邮箱是否重复
|
||||
* @param email 用户邮箱
|
||||
* @return true 表示邮箱已存在,false 表示可用
|
||||
*/
|
||||
public boolean isEmailExists(String email) {
|
||||
long count = companyUserMapper.selectCount(
|
||||
new LambdaQueryWrapper<CompanyUserPO>()
|
||||
.eq(CompanyUserPO::getEmail, email)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断手机号是否重复
|
||||
* @param phone 用户手机号
|
||||
* @return true 表示手机号已存在,false 表示可用
|
||||
*/
|
||||
public boolean isPhoneExists(String phone) {
|
||||
long count = companyUserMapper.selectCount(
|
||||
new LambdaQueryWrapper<CompanyUserPO>()
|
||||
.eq(CompanyUserPO::getPhone, phone)
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
public CompanyUserPO loginByEmailAndPassword(String email, String password){
|
||||
LambdaQueryWrapper<CompanyUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CompanyUserPO::getEmail,email)
|
||||
.eq(CompanyUserPO::getPassword,password);
|
||||
|
||||
return companyUserMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
public CompanyUserPO loginByEmail(String email){
|
||||
LambdaQueryWrapper<CompanyUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CompanyUserPO::getEmail,email);
|
||||
|
||||
return companyUserMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
package cn.link56.feature.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/features")
|
||||
public class FeatureController {
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
b_order AS [order]
|
||||
</sql>
|
||||
|
||||
<select id="listAllArea" resultType="cn.link56.entity.BArea">
|
||||
<select id="listAllArea" resultType="cn.link56.base.model.po.AreaPO">
|
||||
SELECT <include refid="area_columns"/> FROM b_area_sheng WHERE b_canuse = '1'
|
||||
UNION ALL
|
||||
SELECT <include refid="area_columns"/> FROM b_area_shi WHERE b_canuse = '1'
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
<?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="cn.link56.company.mapper.CompanyMapper">
|
||||
|
||||
<select id="listRecommend" resultType="cn.link56.company.model.middle.RecommendCompanyRow">
|
||||
SELECT
|
||||
sheng.b_name AS shengName,
|
||||
shi.b_name AS shiName,
|
||||
|
||||
c.b_id AS companyId,
|
||||
c.b_name AS companyName,
|
||||
c.b_recommend_color AS color
|
||||
FROM b_area_shi shi
|
||||
JOIN b_area_sheng sheng
|
||||
ON shi.b_father_id = sheng.b_id
|
||||
|
||||
LEFT JOIN b_company c
|
||||
ON c.b_canuse = '1'
|
||||
AND c.b_recommend = '1'
|
||||
AND c.b_address LIKE '%' + shi.b_name + '%'
|
||||
|
||||
WHERE
|
||||
shi.b_canuse = '1'
|
||||
AND shi.b_visible = '1'
|
||||
AND sheng.b_canuse = '1'
|
||||
|
||||
ORDER BY
|
||||
sheng.b_order ASC,
|
||||
shi.b_order ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -24,6 +24,7 @@ function handleInitData() {
|
||||
console.log(err)
|
||||
ElMessage.error('初始化失败,请刷新页面后重试')
|
||||
})
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,43 +1,19 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from 'vue'
|
||||
import type { Area, CompanyQuery, Industry } from '@/types/base'
|
||||
import { computed } from 'vue'
|
||||
import { useCommonStore } from '@/store/common'
|
||||
import AreaSelect from './AreaSelect.vue'
|
||||
import IndustrySelect from './IndustrySelect.vue'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Object as PropType<CompanyQuery>,
|
||||
required: true,
|
||||
},
|
||||
industries: {
|
||||
type: Object as PropType<Industry[]>,
|
||||
required: false,
|
||||
},
|
||||
areas: {
|
||||
type: Object as PropType<Area[]>,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const query = computed({
|
||||
get: () => props.modelValue,
|
||||
set: (val: CompanyQuery) => {
|
||||
emit('update:modelValue', val)
|
||||
},
|
||||
})
|
||||
const commonStore = useCommonStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="query">
|
||||
<div class="query-item">
|
||||
<IndustrySelect v-model="query.industries" />
|
||||
<IndustrySelect v-model="commonStore.companyQuery.industries" />
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<AreaSelect
|
||||
v-model="query.areas"
|
||||
v-model="commonStore.companyQuery.areas"
|
||||
multiple
|
||||
check-strictly
|
||||
collapse-tags
|
||||
@@ -47,7 +23,7 @@ const query = computed({
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<el-input
|
||||
v-model="query.name"
|
||||
v-model="commonStore.companyQuery.name"
|
||||
placeholder="请输入公司名称"
|
||||
/>
|
||||
</div>
|
||||
@@ -67,6 +43,8 @@ const query = computed({
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
color: #000;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
|
||||
.query-item {
|
||||
flex: 1;
|
||||
|
||||
@@ -100,7 +78,7 @@ const query = computed({
|
||||
margin-left: 0px;
|
||||
font-size: 18px;
|
||||
}
|
||||
:deep(.el-input__suffix){
|
||||
:deep(.el-input__suffix) {
|
||||
padding-right: 12px;
|
||||
}
|
||||
&:first-child {
|
||||
|
||||
@@ -8,7 +8,7 @@ const userStore = useUserStore()
|
||||
|
||||
const menuList = [
|
||||
{ name: '首页', path: '/' },
|
||||
{ name: '企业名录', path: '/companies' },
|
||||
{ name: '企业名录', path: '/company' },
|
||||
{ name: '论坛中心', path: '/forum' },
|
||||
{ name: '关于我们', path: '/companies' },
|
||||
{ name: '联系我们', path: '/forum' },
|
||||
@@ -23,6 +23,13 @@ function exitLogin() {
|
||||
|
||||
navigateTo('/auth/login')
|
||||
}
|
||||
|
||||
function isActive(path: string) {
|
||||
if (path === '/') {
|
||||
return route.path === '/'
|
||||
}
|
||||
return route.path === path || route.path.startsWith(`${path}/`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -33,8 +40,9 @@ function exitLogin() {
|
||||
<span
|
||||
v-for="item in menuList"
|
||||
:key="item.path"
|
||||
:class="{ active: route.path.startsWith(item.path) }"
|
||||
:class="{ active: isActive(item.path) }"
|
||||
class="menu-item"
|
||||
@click="navigateTo(item.path)"
|
||||
>
|
||||
<span class="menu-item-name">
|
||||
{{ item.name }}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import type { RecommendCompany, RecommendHotCompany } from '@/types/company'
|
||||
import { httpGet } from '@/request/utils'
|
||||
|
||||
export function getRecommendCompanyApi() {
|
||||
return httpGet<RecommendCompany[]>('/company/recommend')
|
||||
}
|
||||
|
||||
export function getRecommendHotCompanyApi() {
|
||||
return httpGet<RecommendHotCompany[]>('/company/recommend/hot')
|
||||
}
|
||||
@@ -14,6 +14,10 @@ const router = createRouter({
|
||||
path: '/',
|
||||
component: () => import('@/views/home/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/company',
|
||||
component: () => import('@/views/company/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
export interface RecommendCompany {
|
||||
shengName: string
|
||||
shiName: string
|
||||
companies: {
|
||||
id: number
|
||||
name: string
|
||||
color: string
|
||||
}[]
|
||||
}
|
||||
|
||||
export interface RecommendHotCompany {
|
||||
id: number
|
||||
name: string
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<script lang="ts" setup>
|
||||
import QueryCompany from '@/components/QueryCompany.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<div class="query">
|
||||
<QueryCompany style="width: 1200px;" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
.query {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,26 +1,15 @@
|
||||
<script lang="ts" setup>
|
||||
const tableData = [
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
import type { PropType } from 'vue'
|
||||
import type { RecommendCompany, RecommendHotCompany } from '@/types/company'
|
||||
|
||||
defineProps({
|
||||
recommedCompanies: {
|
||||
type: Object as PropType<RecommendCompany[]>,
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
recommedHotCompanies: {
|
||||
type: Object as PropType<RecommendHotCompany[]>,
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
]
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -29,12 +18,21 @@ const tableData = [
|
||||
<div class="recommend-title">
|
||||
企业名录
|
||||
</div>
|
||||
|
||||
<!-- <el-table :data="tableData" style="width: 100%" :show-header="false">
|
||||
<el-table-column prop="date" label="地区" width="180" />
|
||||
<el-table-column prop="name" label="公司" />
|
||||
</el-table> -->
|
||||
<el-empty description="暂无企业名录" style="background-color: #fff;" />
|
||||
<div v-if="recommedCompanies && recommedCompanies.length > 0" class="area-list">
|
||||
<div v-for="(item, index) in recommedCompanies" :key="index" class="area-row">
|
||||
<div class="area-name">
|
||||
{{ item.shengName }} {{ item.shiName }}
|
||||
</div>
|
||||
<div class="area-company-box">
|
||||
<div class="area-company-list">
|
||||
<div v-for="company in item.companies" :key="company.id" class="area-company-item" :style="{ color: company.color || '#000' }">
|
||||
{{ company.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-empty v-else description="暂无企业名录" style="background-color: #fff;" />
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
@@ -43,12 +41,18 @@ const tableData = [
|
||||
热门推荐
|
||||
</div>
|
||||
<div class="hot-card-list">
|
||||
<el-empty description="暂无热门推荐" />
|
||||
<template v-if="recommedHotCompanies && recommedHotCompanies.length > 0">
|
||||
<div
|
||||
v-for="(item, i) in recommedHotCompanies"
|
||||
:key="item.id"
|
||||
class="hot-card-item"
|
||||
>
|
||||
<span class="number">{{ i + 1 }}</span>
|
||||
<span class="name">{{ item.name }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- <div v-for="i in 10" :key="i" class="hot-card-item">
|
||||
<span class="number">{{ i }}</span>
|
||||
<span class="name">xxxxxxxxxx公司公司</span>
|
||||
</div> -->
|
||||
<el-empty v-else description="暂无热门推荐" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -75,6 +79,7 @@ const tableData = [
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
|
||||
.hot-card-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -109,5 +114,63 @@ const tableData = [
|
||||
position: relative;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.area-list {
|
||||
background-color: #fff;
|
||||
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
|
||||
overflow: hidden;
|
||||
|
||||
.area-row {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
border-bottom: 1px solid #e0e3e8;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.area-row:hover {
|
||||
background-color: #f9f9fb;
|
||||
}
|
||||
|
||||
.area-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.area-name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 15%;
|
||||
background-color: #f8f9fa;
|
||||
color: #34495e;
|
||||
font-weight: bold;
|
||||
border-right: 1px solid #e0e3e8;
|
||||
padding: 12px;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.area-company-box {
|
||||
flex: 1;
|
||||
padding: 14px 20px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
.area-company-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px 16px;
|
||||
}
|
||||
|
||||
.area-company-item {
|
||||
padding-left: 10px;
|
||||
line-height: 1.8;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.area-company-item:hover {
|
||||
color: #1e80ff;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,5 +1,8 @@
|
||||
<script lang="ts" setup>
|
||||
import type { RecommendCompany, RecommendHotCompany } from '@/types/company'
|
||||
import { onMounted, ref } from 'vue'
|
||||
import QueryCompany from '@/components/QueryCompany.vue'
|
||||
import { getRecommendCompanyApi, getRecommendHotCompanyApi } from '@/request/api/company'
|
||||
import { useCommonStore } from '@/store/common'
|
||||
import Recommend from './components/recommend.vue'
|
||||
|
||||
@@ -10,6 +13,22 @@ const carouselList = [
|
||||
{ img: '/ship-8263464_1920.jpg', href: '' },
|
||||
{ img: '/ship-8263464_1920.jpg', href: '' },
|
||||
]
|
||||
|
||||
const recommendCompanies = ref<RecommendCompany[]>([])
|
||||
const recommendHotCompanies = ref<RecommendHotCompany[]>([])
|
||||
|
||||
onMounted(() => {
|
||||
getRecommendCompanyApi().then((res) => {
|
||||
if (res.isSuccess) {
|
||||
recommendCompanies.value = res.data
|
||||
}
|
||||
})
|
||||
getRecommendHotCompanyApi().then((res) => {
|
||||
if (res.isSuccess) {
|
||||
recommendHotCompanies.value = res.data
|
||||
}
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -32,7 +51,7 @@ const carouselList = [
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Recommend />
|
||||
<Recommend :recommed-companies="recommendCompanies" :recommed-hot-companies="recommendHotCompanies" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in new issue
Block a user