Commit 469bbe6a authored by shiyu's avatar shiyu

类目信息复制

parent 9c2f150a
...@@ -2,11 +2,14 @@ package com.wwdz.ch.admin.job; ...@@ -2,11 +2,14 @@ package com.wwdz.ch.admin.job;
import com.wwdz.ch.db.dao.CategoryDao; import com.wwdz.ch.db.dao.CategoryDao;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.domain.CategoryTemp;
import com.wwdz.ch.db.mapper.CategoryMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -18,6 +21,9 @@ public class SynCategoryInfo { ...@@ -18,6 +21,9 @@ public class SynCategoryInfo {
@Autowired @Autowired
CategoryDao categoryDao; CategoryDao categoryDao;
@Resource
CategoryMapper categoryMapper;
public void execute(int id) { public void execute(int id) {
Category category = categoryDao.findById(id); Category category = categoryDao.findById(id);
...@@ -33,4 +39,17 @@ public class SynCategoryInfo { ...@@ -33,4 +39,17 @@ public class SynCategoryInfo {
} }
/* public void repair(int id) {
List<CategoryTemp> categoryTempList = categoryDao.queryByPidForTemp(id);
logger.info("模板id:{}, 子类目数量:{}", id, categoryTempList.size());
categoryTempList.forEach(categoryTemp -> {
Category category = new Category();
category.setId(categoryTemp.getId());
category.setIcon(categoryTemp.getIcon());
categoryDao.updateById(category);
logger.info("类目id:{}, 更新内容:{}", category.getId(), category);
});
}*/
} }
package com.wwdz.ch.admin.impl; package com.wwdz.ch.admin.impl;
import com.wwdz.ch.admin.job.ImportNephriteDataJob; import com.wwdz.ch.admin.job.ImportNephriteDataJob;
import com.wwdz.ch.admin.job.SynCategoryInfo;
import com.wwdz.ch.admin.job.SynCoinJob; import com.wwdz.ch.admin.job.SynCoinJob;
import com.wwdz.ch.admin.job.SynItemToEsJob; import com.wwdz.ch.admin.job.SynItemToEsJob;
import com.wwdz.ch.db.dao.ItemDao; import com.wwdz.ch.db.dao.ItemDao;
...@@ -31,6 +32,9 @@ public class SynCoinJobTest { ...@@ -31,6 +32,9 @@ public class SynCoinJobTest {
@Autowired @Autowired
ImportNephriteDataJob importNephriteDataJob; ImportNephriteDataJob importNephriteDataJob;
@Autowired
SynCategoryInfo synCategoryInfo;
@Test @Test
public void execute() { public void execute() {
synCoinJob.execute(); synCoinJob.execute();
...@@ -83,4 +87,15 @@ public class SynCoinJobTest { ...@@ -83,4 +87,15 @@ public class SynCoinJobTest {
public void addSizeForCategoryIcon() throws Exception { public void addSizeForCategoryIcon() throws Exception {
synCoinJob.addSizeForCategoryIcon(); synCoinJob.addSizeForCategoryIcon();
} }
@Test
public void synCategoryInfo() throws Exception {
synCategoryInfo.execute(123);
}
/* @Test
public void repair() throws Exception {
synCategoryInfo.repair(1003145);
}*/
} }
\ No newline at end of file
package com.wwdz.ch.db.dao; package com.wwdz.ch.db.dao;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.domain.CategoryTemp;
import com.wwdz.ch.db.dto.request.CategorySearchRequestDto; import com.wwdz.ch.db.dto.request.CategorySearchRequestDto;
import java.util.List; import java.util.List;
...@@ -55,4 +56,6 @@ public interface CategoryDao { ...@@ -55,4 +56,6 @@ public interface CategoryDao {
List<Category> findByPage(CategorySearchRequestDto dto); List<Category> findByPage(CategorySearchRequestDto dto);
} }
package com.wwdz.ch.db.impl; package com.wwdz.ch.db.impl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.wwdz.ch.db.domain.CategoryTemp;
import com.wwdz.ch.db.domain.CategoryTempExample;
import com.wwdz.ch.db.dto.request.CategorySearchRequestDto; import com.wwdz.ch.db.dto.request.CategorySearchRequestDto;
import com.wwdz.ch.db.mapper.CategoryMapper; import com.wwdz.ch.db.mapper.CategoryMapper;
import com.wwdz.ch.db.domain.Category; import com.wwdz.ch.db.domain.Category;
import com.wwdz.ch.db.domain.CategoryExample; import com.wwdz.ch.db.domain.CategoryExample;
import com.wwdz.ch.db.dao.CategoryDao; import com.wwdz.ch.db.dao.CategoryDao;
import com.wwdz.ch.db.mapper.CategoryTempMapper;
import com.xxdxxs.db.component.JdbcHelper; import com.xxdxxs.db.component.JdbcHelper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -23,6 +26,9 @@ public class CategoryDaoImpl implements CategoryDao { ...@@ -23,6 +26,9 @@ public class CategoryDaoImpl implements CategoryDao {
@Resource @Resource
private CategoryMapper categoryMapper; private CategoryMapper categoryMapper;
@Resource
CategoryTempMapper categoryTempMapper;
/** /**
* 根据层级查询类目,默认返回第一页 10个商品 * 根据层级查询类目,默认返回第一页 10个商品
* @param level * @param level
...@@ -152,4 +158,6 @@ public class CategoryDaoImpl implements CategoryDao { ...@@ -152,4 +158,6 @@ public class CategoryDaoImpl implements CategoryDao {
PageHelper.startPage(dto.getPage(), dto.getLimit()); PageHelper.startPage(dto.getPage(), dto.getLimit());
return categoryMapper.selectByExample(example); return categoryMapper.selectByExample(example);
} }
} }
...@@ -40,16 +40,16 @@ ...@@ -40,16 +40,16 @@
</plugin> </plugin>
<!-- 注释 --> <!-- 注释 -->
<!-- 使用自定义的插件 --> <!-- 使用自定义的插件 -->
<!-- <commentGenerator type="com.jbp.db.mybatis.MyCommentGenerator"> <!-- <commentGenerator type="com.jbp.db.mybatis.MyCommentGenerator">
</commentGenerator>--> </commentGenerator>-->
<commentGenerator > <commentGenerator >
<property name="suppressAllComments" value="true"/> <property name="suppressAllComments" value="true"/>
<property name="suppressDate" value="true" /> <property name="suppressDate" value="true" />
</commentGenerator> </commentGenerator>
<!--数据库链接地址账号密码--> <!--数据库链接地址账号密码-->
<jdbcConnection driverClass="com.mysql.jdbc.Driver" <jdbcConnection driverClass="com.mysql.jdbc.Driver"
connectionURL="jdbc:mysql://pc-bp1l2k9j6ck1gr923.mysql.polardb.rds.aliyuncs.com:3306/quanku?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false" connectionURL="jdbc:mysql://pc-bp1l2k9j6ck1gr923.mysql.polardb.rds.aliyuncs.com:3306/quanku?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=UTC&amp;verifyServerCertificate=false&amp;useSSL=false"
userId="quanku" userId="quanku"
password="3N0W8i0b1Wm35MJ5"/> password="3N0W8i0b1Wm35MJ5"/>
...@@ -68,14 +68,14 @@ ...@@ -68,14 +68,14 @@
<property name="trimStrings" value="true"/> <property name="trimStrings" value="true"/>
</javaModelGenerator> </javaModelGenerator>
<sqlMapGenerator targetPackage="com.wwdz.ch.db.dao" targetProject="ch-dao/src/main/resources"/> <sqlMapGenerator targetPackage="com.wwdz.ch.db.mapper" targetProject="ch-dao/src/main/resources"/>
<javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.dao" <javaClientGenerator type="XMLMAPPER" targetPackage="com.wwdz.ch.db.mapper"
targetProject="ch-dao/src/main/java"/> targetProject="ch-dao/src/main/java"/>
<table tableName="favorites_coins_relation" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true"> <table tableName="category_temp" enableCountByExample="true" enableUpdateByExample="true" enableDeleteByExample="true" enableSelectByExample="true" selectByExampleQueryId="true">
<generatedKey column="id" sqlStatement="Mysql" identity="true" /> <generatedKey column="id" sqlStatement="Mysql" identity="true" />
</table> </table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ 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