|
@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.hssx.cloudmodel.constant.Constant;
|
|
import com.hssx.cloudmodel.constant.Constant;
|
|
import com.hssx.cloudmodel.entity.Company;
|
|
import com.hssx.cloudmodel.entity.Company;
|
|
import com.hssx.cloudmodel.entity.Factory;
|
|
import com.hssx.cloudmodel.entity.Factory;
|
|
|
|
+import com.hssx.cloudmodel.entity.LngLatCompany;
|
|
import com.hssx.cloudmodel.entity.User;
|
|
import com.hssx.cloudmodel.entity.User;
|
|
import com.hssx.cloudmodel.entity.vo.CompanyVO;
|
|
import com.hssx.cloudmodel.entity.vo.CompanyVO;
|
|
import com.hssx.cloudmodel.mapper.CompanyMapper;
|
|
import com.hssx.cloudmodel.mapper.CompanyMapper;
|
|
|
|
+import com.hssx.cloudmodel.mapper.LngLatCompanyMapper;
|
|
import com.hssx.cloudmodel.mapper.UserMapper;
|
|
import com.hssx.cloudmodel.mapper.UserMapper;
|
|
import com.hssx.cloudmodel.service.CompanyService;
|
|
import com.hssx.cloudmodel.service.CompanyService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -33,6 +35,8 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
CompanyMapper companyMapper;
|
|
CompanyMapper companyMapper;
|
|
@Resource
|
|
@Resource
|
|
UserMapper userMapper;
|
|
UserMapper userMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ LngLatCompanyMapper lngLatCompanyMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag) {
|
|
public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag) {
|
|
@@ -54,17 +58,34 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
//生产方
|
|
//生产方
|
|
BeanUtils.copyProperties(companyVO,company);
|
|
BeanUtils.copyProperties(companyVO,company);
|
|
companyMapper.insert(company);
|
|
companyMapper.insert(company);
|
|
-// Factory factory = new Factory();
|
|
|
|
-// factory.setxLat(companyVO.getXLat());
|
|
|
|
-// factory.setyLng(companyVO.getYLng());
|
|
|
|
-// factory.
|
|
|
|
-
|
|
|
|
|
|
+ LngLatCompany factory = new LngLatCompany();
|
|
|
|
+ factory.setxLat(companyVO.getXLat());
|
|
|
|
+ factory.setyLng(companyVO.getYLng());
|
|
|
|
+ factory.setCompanyId(company.getId());
|
|
|
|
+ lngLatCompanyMapper.insert(factory);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else if (flag == 1) {
|
|
} else if (flag == 1) {
|
|
//更新公司信息
|
|
//更新公司信息
|
|
BeanUtils.copyProperties(companyVO,company);
|
|
BeanUtils.copyProperties(companyVO,company);
|
|
- companyMapper.updateById(company);
|
|
|
|
|
|
+ if (companyVO.getCompanyType() == 0) {
|
|
|
|
+ //修改资产方
|
|
|
|
+ BeanUtils.copyProperties(companyVO,company);
|
|
|
|
+ companyMapper.updateById(company);
|
|
|
|
+ }else if (companyVO.getCompanyType() == 1){
|
|
|
|
+ //生产方
|
|
|
|
+ BeanUtils.copyProperties(companyVO,company);
|
|
|
|
+ companyMapper.updateById(company);
|
|
|
|
+ QueryWrapper<LngLatCompany> qw = new QueryWrapper<>();
|
|
|
|
+ qw.eq("company_id",companyVO.getId());
|
|
|
|
+ LngLatCompany lngLatCompany = lngLatCompanyMapper.selectOne(qw);
|
|
|
|
+ LngLatCompany factory = new LngLatCompany();
|
|
|
|
+ factory.setxLat(companyVO.getXLat());
|
|
|
|
+ factory.setyLng(companyVO.getYLng());
|
|
|
|
+ factory.setCompanyId(company.getId());
|
|
|
|
+ factory.setId(lngLatCompany.getId());
|
|
|
|
+ lngLatCompanyMapper.updateById(factory);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
@@ -83,7 +104,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|
Integer count = companyMapper.selectCount(qw);
|
|
Integer count = companyMapper.selectCount(qw);
|
|
page.setTotal(count);
|
|
page.setTotal(count);
|
|
page.setPages(page.getTotal());
|
|
page.setPages(page.getTotal());
|
|
- List<Company> list = companyMapper.getListByKeyName(keyName, start, page.getPageSize());
|
|
|
|
|
|
+ List<Company> list = companyMapper.getListByKeyName(keyName, start, page.getPageSize(),companyType);
|
|
page.setList(list);
|
|
page.setList(list);
|
|
msg.data = page;
|
|
msg.data = page;
|
|
return msg;
|
|
return msg;
|