Prechádzať zdrojové kódy

时间标签的添加

5 rokov pred
rodič
commit
f428a01b31

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/mapper/CompanyMapper.java

@@ -17,6 +17,6 @@ import java.util.List;
  */
 public interface CompanyMapper extends BaseMapper<Company> {
 
-    List<Company> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize);
+    List<Company> getListByKeyName(@Param("keyName") String keyName, @Param("start")Integer start, @Param("pageSize") Integer pageSize,@Param("companyType")Integer companyType);
 
 }

+ 28 - 7
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.cloudmodel.constant.Constant;
 import com.hssx.cloudmodel.entity.Company;
 import com.hssx.cloudmodel.entity.Factory;
+import com.hssx.cloudmodel.entity.LngLatCompany;
 import com.hssx.cloudmodel.entity.User;
 import com.hssx.cloudmodel.entity.vo.CompanyVO;
 import com.hssx.cloudmodel.mapper.CompanyMapper;
+import com.hssx.cloudmodel.mapper.LngLatCompanyMapper;
 import com.hssx.cloudmodel.mapper.UserMapper;
 import com.hssx.cloudmodel.service.CompanyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -33,6 +35,8 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
     CompanyMapper companyMapper;
     @Resource
     UserMapper userMapper;
+    @Resource
+    LngLatCompanyMapper lngLatCompanyMapper;
 
     @Override
     public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag) {
@@ -54,17 +58,34 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
                     //生产方
                     BeanUtils.copyProperties(companyVO,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) {
             //更新公司信息
             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;
     }
@@ -83,7 +104,7 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         Integer count = companyMapper.selectCount(qw);
         page.setTotal(count);
         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);
         msg.data = page;
         return msg;

+ 1 - 1
cloud-model/src/main/java/com/hssx/cloudmodel/util/CodeGenerator.java

@@ -204,7 +204,7 @@ public class CodeGenerator {
         //若想要生成的实体类继承某个Controller,则可打开下面注释。写上需要继承的Controller的位置即可
 //        strategy.setSuperControllerClass("com.baomidou.ant.common.BaseController");
         //此处user是表名,多个英文逗号分割
-        strategy.setInclude("tb_mould_file".split(","));
+        strategy.setInclude("tb_lng_lat_company");
 //        strategy.setExclude();//数据库表全生成
 //        strategy.setInclude(scanner("user").split(","));//表名,多个英文逗号分割
         strategy.setControllerMappingHyphenStyle(true);

+ 4 - 1
cloud-model/src/main/resources/mapper/CompanyMapper.xml

@@ -22,7 +22,10 @@
         tb_company
         <where>
             <if test="keyName != null and keyName != ''">
-                company_name like concat('%',#{keyName},'%')
+               and company_name like concat('%',#{keyName},'%')
+            </if>
+            <if test="keyName != null and keyName != ''">
+                and company_type = #{companyType}
             </if>
         </where>
         Limit #{start},#{pageSize}