chenjiahe
2022-04-06 a48817ffcb840ed803c813c010f3730eb7e9cb87
优化
1 文件已重命名
3个文件已修改
14 ■■■■■ 已修改文件
src/main/java/com/hx/common/dao/mapper/CommonMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/common/service/impl/CommonDaoImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/common/xml/CommonMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/mybatis/aes/springbean/InitMysqlData.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/hx/common/dao/mapper/CommonMapper.java
File was renamed from src/main/java/com/hx/common/dao/CommonMapper.java
@@ -1,8 +1,8 @@
package com.hx.common.dao;
package com.hx.common.dao.mapper;
import com.hx.mybatisTool.SqlSentence;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
src/main/java/com/hx/common/service/impl/CommonDaoImpl.java
@@ -1,7 +1,7 @@
package com.hx.common.service.impl;
import com.hx.common.dao.CommonDao;
import com.hx.common.dao.CommonMapper;
import com.hx.common.dao.mapper.CommonMapper;
import com.hx.mybatisTool.SqlSentence;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Service;
src/main/java/com/hx/common/xml/CommonMapper.xml
@@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!-- namespace:该mapper.xml映射文件的 唯一标识 -->
<mapper namespace="com.hx.common.dao.CommonMapper">
<mapper namespace="com.hx.common.dao.mapper.CommonMapper">
    <update id="updateSentence" parameterType="com.hx.mybatisTool.SqlSentence" >
         ${sqlSentence}
    </update>
src/main/java/com/hx/mybatis/aes/springbean/InitMysqlData.java
@@ -3,7 +3,7 @@
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.hx.common.annotations.MysqlHexAes;
import com.hx.common.dao.CommonMapper;
import com.hx.common.dao.mapper.CommonMapper;
import com.hx.common.service.CommonService;
import com.hx.exception.ServiceException;
import com.hx.mybatisTool.SqlSentence;
@@ -41,6 +41,7 @@
                for(FieldData fieldData:fieldDatas){
                    //获取条数
                    sqlSentence.sqlSentence("SELECT COUNT(0) FROM "+fieldData.getTableName(),values);
                    System.out.println("sqlSentence3:"+sqlSentence.getSqlSentence());
                    int total = commonService.selectCountSql(sqlSentence);
                    if(total ==0 ){
                        continue;
@@ -77,6 +78,7 @@
            selectField.append(","+fieldName);
        }
        sqlSentence.sqlSentence("SELECT "+selectField.toString()+" FROM "+fieldData.getTableName()+" LIMIT "+pageNum+","+pageSize,values);
        System.out.println("sqlSentence:"+sqlSentence.getSqlSentence());
        List<Map<String,Object>> list = commonService.selectListMap(CommonMapper.class,sqlSentence);
        for (Map<String,Object> map:list){
@@ -101,6 +103,8 @@
            values = map;
            sqlSentence.sqlSentence("UPDATE "+fieldData.getTableName()+" SET "+setField.toString()+" WHERE "+fieldData.getId()+" = #{m."+fieldData.getId()+"}",values);
            System.out.println("sqlSentence2:"+sqlSentence.getSqlSentence());
            if(commonService.updateSentence(sqlSentence)!=1){
                throw new ServiceException("更新超过1条,更新失败!");
            }