Commit 67260615 authored by unset's avatar unset

Merge branch 'master-vehicle-price' into dev-tiande

parents bb4ae165 6b744cf9
...@@ -16,6 +16,7 @@ spring: ...@@ -16,6 +16,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml shared-dataids: common-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -2,13 +2,16 @@ package com.github.wxiaoqi.security.common.biz; ...@@ -2,13 +2,16 @@ package com.github.wxiaoqi.security.common.biz;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse; import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.EntityUtils; import com.github.wxiaoqi.security.common.util.EntityUtils;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType; import java.lang.reflect.ParameterizedType;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
...@@ -125,6 +128,88 @@ public abstract class BaseBiz<M extends Mapper<T>, T> { ...@@ -125,6 +128,88 @@ public abstract class BaseBiz<M extends Mapper<T>, T> {
return new TableResultResponse<T>(result.getTotal(), list); return new TableResultResponse<T>(result.getTotal(), list);
} }
public TableResultResponse<T> selectPageByQuery(Query query) {
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
Example example = new Example(clazz);
Example.Criteria criteria=null;
if (checkFieldName(clazz,"isDel")){
criteria=example.createCriteria();
criteria.andEqualTo("isDel",0);
}
if (checkFieldName(clazz,"isDelete")){
criteria=example.createCriteria();
criteria.andEqualTo("isDelete",0);
}
if(query.entrySet().size()>0) {
if (criteria==null){
criteria=example.createCriteria();
}
for (Map.Entry<String, Object> entry : query.entrySet()) {
if(null != entry.getValue()) {
criteria.andLike(entry.getKey(), "%" + entry.getValue().toString() + "%");
}
}
}
if (checkFieldName(clazz,"sortOrder")) {
example.setOrderByClause("sort_order desc");
}else if(checkFieldName(clazz,"rank")){
example.setOrderByClause("rank desc");
}else {
example.setOrderByClause("id desc");
}
Page<Object> result = PageHelper.startPage(query.getPage(), query.getLimit());
List<T> list = mapper.selectByExample(example);
return new TableResultResponse<T>(result.getTotal(), list);
}
public ObjectRestResponse selectAll(){
List<T> list = selectListAlls();
return ObjectRestResponse.succ(list);
}
public List<T> selectListAlls(){
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
Example example = new Example(clazz);
Example.Criteria criteria=example.createCriteria();
if (checkFieldName(clazz,"isDel")){
criteria.andEqualTo("isDel",0);
}
if (checkFieldName(clazz,"sortOrder")){
example.setOrderByClause("sort_order desc");
}else if(checkFieldName(clazz,"rank")){
example.setOrderByClause("rank desc");
}else {
example.setOrderByClause("id desc");
}
return mapper.selectByExample(example);
}
public List<T> getList(String appId)throws Exception{
Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[1];
Example example = new Example(clazz);
Example.Criteria criteria=example.createCriteria();
if (checkFieldName(clazz,"isDel")){
criteria.andEqualTo("isDel",0);
}
example.setOrderByClause("id desc");
return mapper.selectByExample(example);
}
public boolean checkFieldName(Class<T> clazz,String fieldname){
Field[] fields=clazz.getDeclaredFields();
boolean flag=false;
for (int i = 0; i < fields.length; i++) {
if(fields[i].getName().equals(fieldname))
{
flag=true;
break;
}
}
return flag;
}
} }
...@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler; ...@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.msg.TableResultResponse; import com.github.wxiaoqi.security.common.msg.TableResultResponse;
import com.github.wxiaoqi.security.common.util.Query; import com.github.wxiaoqi.security.common.util.Query;
import com.github.wxiaoqi.security.common.util.ReflectionUtils;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -76,7 +77,7 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro ...@@ -76,7 +77,7 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
public TableResultResponse<Entity> list(@RequestParam Map<String, Object> params){ public TableResultResponse<Entity> list(@RequestParam Map<String, Object> params){
//查询列表数据 //查询列表数据
Query query = new Query(params); Query query = new Query(params);
return baseBiz.selectByQuery(query); return baseBiz.selectPageByQuery(query);
} }
@ApiOperation("根据参数查询,等于") @ApiOperation("根据参数查询,等于")
...@@ -88,4 +89,22 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro ...@@ -88,4 +89,22 @@ public class BaseController<Biz extends BaseBiz,Entity> extends CommonBaseContro
} }
@ApiOperation("查询所有")
@RequestMapping(value = "/alls",method = RequestMethod.GET)
@ResponseBody
public ObjectRestResponse alls(){
return baseBiz.selectAll();
}
@ApiOperation("删除")
@RequestMapping(value = "/del",method = RequestMethod.DELETE)
@ResponseBody
public ObjectRestResponse del( Entity entity){
ReflectionUtils.setFieldValue(entity,"isDel",1);
baseBiz.updateSelectiveById(entity);
return ObjectRestResponse.succ();
}
} }
...@@ -5,6 +5,7 @@ spring: ...@@ -5,6 +5,7 @@ spring:
nacos: nacos:
discovery: discovery:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
namespace: tiande_spcloud
server: server:
port: 8764 #启动端口 port: 8764 #启动端口
......
...@@ -19,6 +19,7 @@ spring: ...@@ -19,6 +19,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel; ...@@ -5,7 +5,6 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken; import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import tk.mybatis.mapper.entity.Example; import tk.mybatis.mapper.entity.Example;
......
...@@ -18,7 +18,7 @@ spring: ...@@ -18,7 +18,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
<if test="realName !=null and realName != ''"> <if test="realName !=null and realName != ''">
and d.realname like CONCAT('%',#{realName},'%') and d.realname like CONCAT('%',#{realName},'%')
</if> </if>
<if test="citySet != null "> <if test="citySet != null and citySet.size > 0 ">
and d.city_code in and d.city_code in
<foreach collection="citySet" item="item" index="index" open="(" separator="," close=")"> <foreach collection="citySet" item="item" index="index" open="(" separator="," close=")">
#{item} #{item}
......
...@@ -26,6 +26,7 @@ spring: ...@@ -26,6 +26,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -26,6 +26,7 @@ spring: ...@@ -26,6 +26,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -16,7 +16,7 @@ spring: ...@@ -16,7 +16,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -26,6 +26,7 @@ spring: ...@@ -26,6 +26,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -16,7 +16,7 @@ spring: ...@@ -16,7 +16,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,+ mongodb日志配置 #共用配置,+ mongodb日志配置
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
#--- #---
#spring: #spring:
# profiles: pro # profiles: pro
......
...@@ -26,6 +26,7 @@ spring: ...@@ -26,6 +26,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -37,6 +37,7 @@ spring: ...@@ -37,6 +37,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -17,6 +17,7 @@ spring: ...@@ -17,6 +17,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -27,6 +27,7 @@ spring: ...@@ -27,6 +27,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -17,6 +17,7 @@ spring: ...@@ -17,6 +17,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -22,12 +22,22 @@ public class BranchCompany { ...@@ -22,12 +22,22 @@ public class BranchCompany {
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
private Integer companyBaseId; private Integer companyBaseId;
@Column(name = "company_id")
@ApiModelProperty("公司id")
private Long companyId;
/** /**
* 分公司名称 * 分公司名称
*/ */
@ApiModelProperty("分公司名称") @ApiModelProperty("分公司名称")
private String name; private String name;
@Column(name = "short_name")
@ApiModelProperty("简称")
private String shortName;
/** /**
* 分支机构类型 * 分支机构类型
*/ */
......
package com.xxfc.platform.vehicle.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Data
@Table(name = "company_info")
public class CompanyInfo {
@Id
@GeneratedValue(generator = "JDBC")
@ApiModelProperty("主键id")
private Long id;
@ApiModelProperty("公司名称")
private String name;
@ApiModelProperty("法人姓名")
@Column(name = "legal_person")
private String legalPerson;
@ApiModelProperty("公司名称")
@Column(name = "legal_id_number")
private String legalIdNumber;
@ApiModelProperty("联系人")
private String contact;
@ApiModelProperty("联系电话")
private String mobile;
@ApiModelProperty("营业执照")
@Column(name = "business_license")
private String businessLicense;
@Column(name = "crt_time")
private Long crtTime;
@Column(name = "upd_time")
private Long updTime;
@Column(name = "is_del")
private Integer isDel;
}
\ No newline at end of file
package com.xxfc.platform.vehicle.pojo; package com.xxfc.platform.vehicle.pojo;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data; import lombok.Data;
@Data @Data
public class CompanySearchDTO { public class CompanySearchDTO extends PageParam {
Integer page;
Integer limit;
Integer addrCity; Integer addrCity;
String lon; String lon;
String lat; String lat;
Integer state; Integer state;
Integer isShow = 1; Integer isShow;
Integer isDel = 0; Integer isDel;
Integer addrProvince;
Long companyId;
String name;
Integer id;
} }
...@@ -8,4 +8,6 @@ import java.math.BigDecimal; ...@@ -8,4 +8,6 @@ import java.math.BigDecimal;
@Data @Data
public class CompanySearchVO extends BranchCompany { public class CompanySearchVO extends BranchCompany {
BigDecimal distance; BigDecimal distance;
String companyName;
} }
...@@ -56,7 +56,10 @@ public class ResultVehicleVo { ...@@ -56,7 +56,10 @@ public class ResultVehicleVo {
*/ */
private String parkBranchCompanyName; private String parkBranchCompanyName;
/**
* 所属公司名称
*/
private String companyName;
/** /**
* 目的地分支机构(id) * 目的地分支机构(id)
......
...@@ -88,6 +88,10 @@ public class VehicleExcelVo { ...@@ -88,6 +88,10 @@ public class VehicleExcelVo {
private String insuranceNo; private String insuranceNo;
/**
* 所属公司名称
*/
private String companyName;
/** /**
......
package com.xxfc.platform.vehicle.pojo; package com.xxfc.platform.vehicle.pojo;
import com.sun.org.apache.xpath.internal.operations.Bool;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
......
package com.xxfc.platform.vehicle.pojo.dto;
import com.github.wxiaoqi.security.common.vo.PageParam;
import lombok.Data;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/8/23 16:27
*/
@Data
public class CompanyInfoFindDTO extends PageParam {
private String name;
}
...@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper; ...@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import com.xxfc.platform.vehicle.pojo.BranchCompanyVo; import com.xxfc.platform.vehicle.pojo.BranchCompanyVo;
import com.xxfc.platform.vehicle.pojo.CompanyDetail; import com.xxfc.platform.vehicle.pojo.CompanyDetail;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO; import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
...@@ -214,13 +215,18 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -214,13 +215,18 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return PageDataVO.pageInfo(branchCompanyPageInfo); return PageDataVO.pageInfo(branchCompanyPageInfo);
} }
public PageDataVO<BranchCompany> search(CompanySearchDTO vo) { public PageDataVO<CompanySearchVO> search(CompanySearchDTO vo) {
PageHelper.startPage(vo.getPage(), vo.getLimit()); PageHelper.startPage(vo.getPage(), vo.getLimit());
PageInfo<BranchCompany> branchCompanyPageInfo = new PageInfo<>(mapper.search(vo.getLon(), vo.getLat(), vo.getAddrCity(), vo.getState(), vo.getIsShow(), vo.getIsDel())); PageInfo<CompanySearchVO> branchCompanyPageInfo = new PageInfo<>(getList(vo));
return PageDataVO.pageInfo(branchCompanyPageInfo); return PageDataVO.pageInfo(branchCompanyPageInfo);
} }
public List<CompanySearchVO> getList(CompanySearchDTO vo){
return mapper.search(vo);
}
@Cache(key = RedisKey.BRANCH_COMPANY_CACHE_ALL) @Cache(key = RedisKey.BRANCH_COMPANY_CACHE_ALL)
public List<BranchCompany> getAll() { public List<BranchCompany> getAll() {
Example example = new Example(BranchCompany.class); Example example = new Example(BranchCompany.class);
......
package com.xxfc.platform.vehicle.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import com.xxfc.platform.vehicle.mapper.CompanyInfoMapper;
import com.xxfc.platform.vehicle.pojo.dto.CompanyInfoFindDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import java.util.List;
@Service
@Slf4j
public class CompanyInfoBiz extends BaseBiz<CompanyInfoMapper, CompanyInfo>{
public ObjectRestResponse addOrUpd(CompanyInfo companyInfo){
Long id = companyInfo.getId() == null ? 0L :companyInfo.getId();
if (id > 0L){
updateSelectiveById(companyInfo);
}else {
insertSelective(companyInfo);
}
return ObjectRestResponse.succ();
}
public List<CompanyInfo> getList(CompanyInfoFindDTO companyInfoFindDTO){
Example example=new Example(CompanyInfo.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("isDel",0);
if (StringUtils.isNotBlank(companyInfoFindDTO.getName()) ){
criteria.andLike("name","%" + companyInfoFindDTO.getName() + "%");
}
example.setOrderByClause("crt_time desc ");
return selectByExample(example);
}
public ObjectRestResponse selectList(CompanyInfoFindDTO companyInfoFindDTO){
PageHelper.startPage(companyInfoFindDTO.getPage(), companyInfoFindDTO.getLimit());
PageInfo<CompanyInfo> pageInfo = new PageInfo<>(getList(companyInfoFindDTO));
return ObjectRestResponse.succ(PageDataVO.pageInfo(pageInfo));
}
}
...@@ -2,6 +2,8 @@ package com.xxfc.platform.vehicle.mapper; ...@@ -2,6 +2,8 @@ package com.xxfc.platform.vehicle.mapper;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.xxfc.platform.vehicle.entity.BranchCompany; import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO;
import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO; import com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -13,7 +15,7 @@ import java.util.List; ...@@ -13,7 +15,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdListMapper<BranchCompany,Integer> { public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdListMapper<BranchCompany,Integer> {
List<BranchCompany> search(@Param("lon") String lon, @Param("lat") String lat, @Param("addrCity") Integer addrCity, Integer state, Integer isShow, Integer isDel); List<CompanySearchVO> search(CompanySearchDTO companySearchDTO);
List<BranchCompany> selectByZoneId(Map<String, Object> param); List<BranchCompany> selectByZoneId(Map<String, Object> param);
List<Integer> findCompanyIdsByAreaId(@Param("areaId") Integer areaId); List<Integer> findCompanyIdsByAreaId(@Param("areaId") Integer areaId);
......
package com.xxfc.platform.vehicle.mapper;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;
public interface CompanyInfoMapper extends Mapper<CompanyInfo>, SelectByIdListMapper<CompanyInfo,Long> {
}
\ No newline at end of file
...@@ -74,12 +74,6 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -74,12 +74,6 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, null,null)); return RestResponse.data(baseBiz.getAll(page,limit,addrProvince, addrCity, addrTown, null,null));
} }
@RequestMapping(value ="/search",method = RequestMethod.GET)
@IgnoreUserToken
@IgnoreClientToken
public RestResponse<PageDataVO<BranchCompany>> search(@Validated CompanySearchDTO vo) {
return RestResponse.data(baseBiz.search(vo));
}
@RequestMapping(value ="",method = RequestMethod.GET) @RequestMapping(value ="",method = RequestMethod.GET)
public RestResponse<List<BranchCompany>> getAll() { public RestResponse<List<BranchCompany>> getAll() {
...@@ -234,4 +228,10 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -234,4 +228,10 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return baseBiz.findBranchCompanyAreaByIds(compnayIds); return baseBiz.findBranchCompanyAreaByIds(compnayIds);
} }
@GetMapping("/alls")
public ObjectRestResponse alls(CompanySearchDTO vo){
return ObjectRestResponse.succ(baseBiz.getList(vo));
}
} }
...@@ -24,6 +24,7 @@ public class VehicleHolidayPriceInfoController extends BaseController<VehicleHol ...@@ -24,6 +24,7 @@ public class VehicleHolidayPriceInfoController extends BaseController<VehicleHol
public ObjectRestResponse getAllByVehicleId(String vehicleId) { public ObjectRestResponse getAllByVehicleId(String vehicleId) {
return baseBiz.getByVehicleId(vehicleId); return baseBiz.getByVehicleId(vehicleId);
} }
@GetMapping(value = "getOne") @GetMapping(value = "getOne")
public ObjectRestResponse getOne(Integer id) { public ObjectRestResponse getOne(Integer id) {
return ObjectRestResponse.succ(baseBiz.selectById(id)); return ObjectRestResponse.succ(baseBiz.selectById(id));
......
package com.xxfc.platform.vehicle.rest.admin;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken;
import com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.vehicle.biz.BranchCompanyBiz;
import com.xxfc.platform.vehicle.common.RestResponse;
import com.xxfc.platform.vehicle.entity.BranchCompany;
import com.xxfc.platform.vehicle.pojo.CompanySearchDTO;
import com.xxfc.platform.vehicle.pojo.CompanySearchVO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("admin/branchCompany")
@Slf4j
@IgnoreClientToken
@IgnoreUserToken
@Api(value="公司controller",tags={"公司操作接口"})
public class AdminBranchCompanyController extends BaseController<BranchCompanyBiz,BranchCompany> {
@RequestMapping(value ="/search",method = RequestMethod.GET)
public RestResponse<PageDataVO<CompanySearchVO>> search(@Validated CompanySearchDTO vo) {
return RestResponse.data(baseBiz.search(vo));
}
@RequestMapping(value ="/details",method = RequestMethod.GET)
public RestResponse details(@Validated CompanySearchDTO vo) {
List<CompanySearchVO> list = baseBiz.getList(vo);
CompanySearchVO companySearchVO=new CompanySearchVO();
if (list.size() > 0){
companySearchVO=list.get(0);
}
return RestResponse.data(companySearchVO);
}
}
package com.xxfc.platform.vehicle.rest.admin;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.vehicle.biz.CompanyInfoBiz;
import com.xxfc.platform.vehicle.entity.CompanyInfo;
import com.xxfc.platform.vehicle.pojo.dto.CompanyInfoFindDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("company/info")
public class CompanyInfoController extends BaseController<CompanyInfoBiz,CompanyInfo> {
@ApiOperation("查询公司列表")
@RequestMapping(value = "/selectList", method = RequestMethod.GET)
public ObjectRestResponse getList(CompanyInfoFindDTO companyInfoFindDTO){
return baseBiz.selectList(companyInfoFindDTO);
}
@ApiOperation("新增公司")
@RequestMapping(value = "/save", method = RequestMethod.POST)
public ObjectRestResponse saveCompany(@RequestBody CompanyInfo companyInfo){
return baseBiz.addOrUpd(companyInfo);
}
@ApiOperation("更新公司")
@RequestMapping(value = "/upd", method = RequestMethod.POST)
public ObjectRestResponse updCompany(@RequestBody CompanyInfo companyInfo){
return baseBiz.addOrUpd(companyInfo);
}
@ApiOperation("删除")
@RequestMapping(value = "/del", method = RequestMethod.POST)
public ObjectRestResponse delCompany(@RequestBody CompanyInfo companyInfo){
companyInfo.setIsDel(1);
return baseBiz.addOrUpd(companyInfo);
}
}
...@@ -26,7 +26,7 @@ spring: ...@@ -26,7 +26,7 @@ spring:
server-addr: 127.0.0.1:8848 server-addr: 127.0.0.1:8848
#共用配置,暂定一个 #共用配置,暂定一个
shared-dataids: common-dev.yaml,mongodb-log-dev.yaml shared-dataids: common-dev.yaml,mongodb-log-dev.yaml
namespace: tiande_spcloud
--- ---
spring: spring:
profiles: pro profiles: pro
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
--> -->
<id column="id" property="id" jdbcType="INTEGER"/> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="name" property="name" jdbcType="VARCHAR"/> <result column="name" property="name" jdbcType="VARCHAR"/>
<result column="short_name" property="shortName" jdbcType="VARCHAR"/>
<result column="branch_type" property="branchType" jdbcType="INTEGER"/> <result column="branch_type" property="branchType" jdbcType="INTEGER"/>
<result column="subordinate_branch" property="subordinateBranch" jdbcType="INTEGER"/> <result column="subordinate_branch" property="subordinateBranch" jdbcType="INTEGER"/>
<result column="addr_province" property="addrProvince" jdbcType="INTEGER"/> <result column="addr_province" property="addrProvince" jdbcType="INTEGER"/>
...@@ -23,32 +24,48 @@ ...@@ -23,32 +24,48 @@
<result column="state" property="state"/> <result column="state" property="state"/>
</resultMap> </resultMap>
<select id="search" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO"> <select id="search" parameterType="com.xxfc.platform.vehicle.pojo.CompanySearchDTO" resultType="com.xxfc.platform.vehicle.pojo.CompanySearchVO">
select * select c.*,i.name as companyName
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
, st_distance_sphere(point(#{lon}, #{lat}), point(longitude, latitude)) as distance , st_distance_sphere(point(#{lon}, #{lat}), point(c.longitude, c.latitude)) as distance
</if> </if>
from branch_company from branch_company c
LEFT JOIN company_info i on c.company_id=i.id
<where> <where>
c.is_del = 0
<if test="id != null">
and c.id = #{id}
</if>
<if test="addrCity != null"> <if test="addrCity != null">
and (addr_city = #{addrCity} or addr_province = #{addrCity} or addr_town = #{addrCity}) and (c.addr_city = #{addrCity} or c.addr_province = #{addrCity} or c.addr_town = #{addrCity})
</if>
<if test="addrProvince != null">
and c.addr_province = #{addrProvince}
</if> </if>
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
and longitude is not null and latitude is not null and c.longitude is not null and c.latitude is not null
</if> </if>
<if test="state != null"> <if test="state != null">
and state = #{state} and c.state = #{state}
</if>
<if test="companyId != null">
and c.company_id = #{companyId}
</if> </if>
<if test="isShow != null"> <if test="isShow != null">
and is_show = #{isShow} and c.is_show = #{isShow}
</if> </if>
<if test="isDel != null"> <if test="name != null and name != '' ">
and is_del = #{isDel} and ( c.name like concat('%',#{name},'%') or c.short_name like concat('%',#{name},'%') )
</if> </if>
</where> </where>
<if test="lon != null and lat != null"> <choose>
order by distance asc <when test="lon != null and lat != null">
</if> order by c.distance asc
</when>
<otherwise>
order by c.id desc
</otherwise>
</choose>
</select> </select>
<select id="selectByZoneId" parameterType="java.util.Map" <select id="selectByZoneId" parameterType="java.util.Map"
resultType="com.xxfc.platform.vehicle.entity.BranchCompany"> resultType="com.xxfc.platform.vehicle.entity.BranchCompany">
......
...@@ -76,6 +76,7 @@ ...@@ -76,6 +76,7 @@
v.vehicle_inner_status, v.vehicle_inner_status,
v.mileage_last_update as mileage, v.mileage_last_update as mileage,
c.val as useTypeName, c.val as useTypeName,
ci.name as companyName,
vm.name as vehicleType vm.name as vehicleType
<if test=" yearMonthAndParam != null "> <if test=" yearMonthAndParam != null ">
,vbi.booked_date ,vbi.booked_date
...@@ -96,6 +97,7 @@ ...@@ -96,6 +97,7 @@
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1) LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN company_info ci on ci.id = bc2.company_id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where where
v.is_del=0 v.is_del=0
...@@ -229,6 +231,7 @@ ...@@ -229,6 +231,7 @@
v.vehicle_inner_status, v.vehicle_inner_status,
v.mileage_last_update as mileage, v.mileage_last_update as mileage,
c.val as useTypeName, c.val as useTypeName,
ci.name as companyName,
vm.name as vehicleType vm.name as vehicleType
<if test=" yearMonthAndParam !=null "> <if test=" yearMonthAndParam !=null ">
,vbi.booked_date ,vbi.booked_date
...@@ -247,6 +250,7 @@ ...@@ -247,6 +250,7 @@
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1) LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN company_info ci on ci.id = bc2.company_id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where where
v.is_del=0 v.is_del=0
...@@ -361,6 +365,7 @@ ...@@ -361,6 +365,7 @@
v.number_plate, v.number_plate,
bc.name as parkBranchCompanyName, bc.name as parkBranchCompanyName,
c.val as useType, c.val as useType,
ci.name as companyName,
vm.name as vehicleType vm.name as vehicleType
from vehicle v from vehicle v
<if test=" yearMonthAndParam != null "> <if test=" yearMonthAndParam != null ">
...@@ -378,6 +383,7 @@ ...@@ -378,6 +383,7 @@
LEFT JOIN vehicle_book_record v2 on v2.vehicle_id = v.id LEFT JOIN vehicle_book_record v2 on v2.vehicle_id = v.id
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
LEFT JOIN vehicle_model vm ON v.model_id = vm.id LEFT JOIN vehicle_model vm ON v.model_id = vm.id
LEFT JOIN company_info ci on ci.id = bc2.company_id
LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code LEFT JOIN (select * from constant where type = 2) c ON v.use_type = c.code
where where
v.is_del=0 v.is_del=0
......
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