liulin
2024-07-30 9509af69aff71aeb1f3b62f766e124d291c3f374
适配mybatis-plus
已修改12个文件
1198 ■■■■ 文件已修改
src/main/java/com/lunhan/xxx/common/PagerResult.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/host/controller/TestInfoServiceController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/BasicMapper.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/BasicMapperImpl.java 213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/BasicPO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/imapper/TestInfoMapper.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/mapper/TestInfoMapperImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/po/TestInfoPO.java 43 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/repository/vo/TestInfoVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/service/TestInfoService.java 53 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/service/convert/TestInfoConvert.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/java/com/lunhan/xxx/host/GenCodeGauss.java 655 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lunhan/xxx/common/PagerResult.java
@@ -13,11 +13,11 @@
    /**
     * 页大小(每页返回的记录条数)
     **/
    private Integer limit = 10;
    private Number limit = 10;
    /**
     * 页号(第几页, 从1开始)
     **/
    private Integer page = 1;
    private Number page = 1;
    /**
     * 记录总条数
     **/
@@ -46,25 +46,25 @@
     * @param total 记录总条数
     * @param list 数据包
     */
    public PagerResult(Integer limit, Integer page, Number total, List<T> list) {
    public PagerResult(Number limit, Number page, Number total, List<T> list) {
        this.limit = limit;
        this.page = page;
        this.total = total;
        this.list = list;
    }
    public Integer getLimit() {
    public Number getLimit() {
        return limit;
    }
    public void setLimit(Integer limit) {
    public void setLimit(Number limit) {
        this.limit = limit;
    }
    public Integer getPage() {
    public Number getPage() {
        return page;
    }
    public void setPage(Integer page) {
    public void setPage(Number page) {
        this.page = page;
    }
@@ -96,8 +96,8 @@
     * 总页数
     */
    public Long getTotalPage() {
        Long page = this.total.longValue() / this.limit;
        if(this.total.longValue() % this.limit != 0){
        Long page = this.total.longValue() / this.limit.longValue();
        if(this.total.longValue() % this.limit.longValue() != 0){
            page++;
        }
        return page;
@@ -107,13 +107,13 @@
     * 是否还有上一页
     */
    public boolean getIsHasPrePage() {
        return this.getPage() > 1;
        return this.getPage().longValue() > 1L;
    }
    /**
     * 是否还有下一页
     */
    public boolean getIsHasNextPage() {
        return this.getPage() < this.getTotalPage().intValue();
        return this.getPage().longValue() < this.getTotalPage();
    }
}
src/main/java/com/lunhan/xxx/host/controller/TestInfoServiceController.java
@@ -31,7 +31,7 @@
 * @order 99999
 */
@NonLogin
//@RestController
@RestController
@RequestMapping(value = "testInfo")
public class TestInfoServiceController extends BasicController {
    @Autowired
src/main/java/com/lunhan/xxx/repository/BasicMapper.java
@@ -1,4 +1,126 @@
package com.lunhan.xxx.repository;
public interface BasicMapper {
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lunhan.xxx.common.PagerResult;
import com.lunhan.xxx.entity.dto.SearchBasicDTO;
import org.apache.ibatis.session.ResultHandler;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
public interface BasicMapper<T> extends BaseMapper<T> {
    /**
     * 批量新增
     * @param list 数据实体列表
     */
    Boolean addList(List<T> list);
    /**
     * 批量更新
     * @param list 数据实体列表
     */
    Boolean modifyList(List<T> list);
    /**
     * 批量查询其他实体列表
     * @param queryWrapper 查询条件
     * @param <E> 实体类型
     */
    <E> List<E> selectListObject(Wrapper<T> queryWrapper);
    /**
     * 批量查询其他实体列表
     * @param queryWrapper 查询条件
     * @param resultHandler 查询结果处理器
     * @param <E> 实体类型
     */
    <E> void selectListObject(Wrapper<T> queryWrapper, ResultHandler<E> resultHandler);
    /**
     * 根据主键查询单个数据实体
     *
     * @param id 主键值
     */
    T get(Serializable id);
    /**
     * 条件查询单个数据实体
     *
     * @param queryWrapper 查询条件
     */
    T get(Wrapper<T> queryWrapper);
    /**
     * 根据主键批量获取
     * @param listId 主键列表
     */
    <E extends Serializable> List<T> getList(List<E> listId);
    /**
     * 获取全量数据(慎重)
     */
    List<T> getList();
    /**
     * 根据传入sql查询数据
     *
     * @param queryWrapper 查询条件
     */
    List<Map<String, Object>> getMap(Wrapper<T> queryWrapper);
    /**
     * 查询记录条数
     *
     * @param queryWrapper 查询条件
     */
    Long getCount(Wrapper<T> queryWrapper);
    /**
     * 根据主键id删除数据
     *
     * @param id 主键id
     * @return 是否成功
     */
    Boolean remove(Serializable id);
    /**
     * 根据主键id删除数据
     *
     * @param listId id列表
     * @return 是否成功
     */
    <E extends Serializable> Boolean remove(List<E> listId);
    /**
     * 根据条件删除数据
     *
     * @param queryWrapper 查询条件
     */
    Boolean remove(Wrapper<T> queryWrapper);
    /**
     * 根据主键id逻辑删除数据(逻辑删除)
     *
     * @param id 主键id
     * @return 是否成功
     */
    Boolean deleteLogic(Serializable id);
    /**
     * 根据逐渐删除数据(逻辑删除)
     *
     * @param listId id列表
     * @return 是否成功
     */
    <E extends Serializable> Boolean deleteLogic(List<E> listId);
    /**
     * 分页查询
     *
     * @param search 查询参数
     */
    PagerResult<T> search(SearchBasicDTO search);
}
src/main/java/com/lunhan/xxx/repository/BasicMapperImpl.java
@@ -6,15 +6,17 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.lunhan.xxx.common.PagerResult;
import com.lunhan.xxx.common.enums.ELogger;
import com.lunhan.xxx.common.enums.EResultCode;
import com.lunhan.xxx.common.enums.EYesOrNo;
import com.lunhan.xxx.common.exceptions.BusinessException;
import com.lunhan.xxx.common.util.LoggerUtil;
import com.lunhan.xxx.entity.dto.SearchBasicDTO;
import org.apache.ibatis.executor.BatchResult;
import org.apache.ibatis.session.ResultHandler;
import org.slf4j.Logger;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.Table;
import java.io.Serializable;
@@ -28,7 +30,7 @@
 *
 * @param <T> 数据实体
 */
public class BasicMapper<T> {
public abstract class BasicMapperImpl<T> implements BasicMapper<T> {
    protected BaseMapper<T> DB;
    protected Class<T> clazz;
    protected String tableName;
@@ -38,7 +40,7 @@
    /**
     * 构造方法
     */
    public BasicMapper(BaseMapper<T> db) {
    public BasicMapperImpl(BaseMapper<T> db) {
        this.clazz = (Class<T>) (
                (ParameterizedType) getClass().getGenericSuperclass()
        ).getActualTypeArguments()[0];
@@ -58,90 +60,248 @@
        return Wrappers.update();
    }
    /**
     * 插入一条记录
     *
     * @param entity 实体对象
     */
    public int insert(T entity) {
        return DB.insert(entity);
    }
    /**
     * 根据实体(ID)删除
     *
     * @param entity 实体对象
     * @since 3.4.4
     */
    public int deleteById(T entity) {
        return DB.deleteById(entity);
    }
    /**
     * 根据 entity 条件,删除记录
     *
     * @param queryWrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句)
     */
    public int delete(Wrapper<T> queryWrapper) {
        return DB.delete(queryWrapper);
    }
    /**
     * 根据 ID 修改
     *
     * @param entity 实体对象
     */
    public int updateById(T entity) {
        return DB.updateById(entity);
    }
    /**
     * 根据 whereEntity 条件,更新记录
     *
     * @param entity        实体对象 (set 条件值,可以为 null,当entity为null时,无法进行自动填充)
     * @param updateWrapper 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句)
     */
    public int update(T entity, Wrapper<T> updateWrapper) {
        return DB.update(entity, updateWrapper);
    }
    /**
     * 根据 ID 查询
     *
     * @param id 主键ID
     */
    public T selectById(Serializable id) {
        return DB.selectById(id);
    }
    /**
     * 查询(根据ID 批量查询)
     *
     * @param idList 主键ID列表(不能为 null 以及 empty)
     */
    public List<T> selectBatchIds(Collection<? extends Serializable> idList) {
        return DB.selectBatchIds(idList);
    }
    /**
     * 查询(根据ID 批量查询)
     *
     * @param idList        idList 主键ID列表(不能为 null 以及 empty)
     * @param resultHandler resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public void selectBatchIds(Collection<? extends Serializable> idList, ResultHandler<T> resultHandler) {
        DB.selectBatchIds(idList, resultHandler);
    }
    /**
     * 根据 Wrapper 条件,查询总记录数
     *
     * @param queryWrapper 实体对象封装操作类(可以为 null)
     */
    public Long selectCount(Wrapper<T> queryWrapper) {
        return DB.selectCount(queryWrapper);
    }
    /**
     * 根据 entity 条件,查询全部记录
     *
     * @param queryWrapper 实体对象封装操作类(可以为 null)
     */
    public List<T> selectList(Wrapper<T> queryWrapper) {
        return DB.selectList(queryWrapper);
    }
    /**
     * 根据 entity 条件,查询全部记录
     *
     * @param queryWrapper  实体对象封装操作类(可以为 null)
     * @param resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public void selectList(Wrapper<T> queryWrapper, ResultHandler<T> resultHandler) {
        DB.selectList(queryWrapper, resultHandler);
    }
    /**
     * 根据 entity 条件,查询全部记录(并翻页)
     *
     * @param page         分页查询条件
     * @param queryWrapper 实体对象封装操作类(可以为 null)
     * @since 3.5.3.2
     */
    public List<T> selectList(IPage<T> page, Wrapper<T> queryWrapper) {
        return DB.selectList(page, queryWrapper);
        return DB.selectList(queryWrapper);
    }
    /**
     * 根据 entity 条件,查询全部记录(并翻页)
     *
     * @param page          分页查询条件
     * @param queryWrapper  实体对象封装操作类(可以为 null)
     * @param resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public void selectList(IPage<T> page, Wrapper<T> queryWrapper, ResultHandler<T> resultHandler) {
        DB.selectList(page, queryWrapper, resultHandler);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录
     *
     * @param queryWrapper 实体对象封装操作类
     */
    public List<Map<String, Object>> selectMaps(Wrapper<T> queryWrapper) {
        return DB.selectMaps(queryWrapper);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录
     *
     * @param queryWrapper  实体对象封装操作类
     * @param resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public void selectMaps(Wrapper<T> queryWrapper, ResultHandler<Map<String, Object>> resultHandler) {
        DB.selectMaps(queryWrapper, resultHandler);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录(并翻页)
     *
     * @param page         分页查询条件
     * @param queryWrapper 实体对象封装操作类
     * @since 3.5.3.2
     */
    public List<Map<String, Object>> selectMaps(IPage<? extends Map<String, Object>> page, Wrapper<T> queryWrapper) {
        return DB.selectMaps(page, queryWrapper);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录(并翻页)
     *
     * @param page          分页查询条件
     * @param queryWrapper  实体对象封装操作类
     * @param resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public void selectMaps(IPage<? extends Map<String, Object>> page, Wrapper<T> queryWrapper, ResultHandler<Map<String, Object>> resultHandler) {
        DB.selectMaps(page, queryWrapper, resultHandler);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录
     * <p>注意: 只返回第一个字段的值</p>
     *
     * @param queryWrapper 实体对象封装操作类(可以为 null)
     */
    public <E> List<E> selectObjs(Wrapper<T> queryWrapper) {
        return DB.selectObjs(queryWrapper);
    }
    /**
     * 根据 Wrapper 条件,查询全部记录
     * <p>注意: 只返回第一个字段的值</p>
     *
     * @param queryWrapper  实体对象封装操作类(可以为 null)
     * @param resultHandler 结果处理器 {@link ResultHandler}
     * @since 3.5.4
     */
    public <E> void selectObjs(Wrapper<T> queryWrapper, ResultHandler<E> resultHandler) {
        DB.selectObjs(queryWrapper, resultHandler);
    }
    /**
     * 批量新增
     *
     * @param list 数据实体列表
     */
    public Boolean addList(List<T> list) {
        List<BatchResult> batchResult = DB.insert(list);
        // TODO 判断成功
        return Boolean.TRUE;
    }
    /**
     * 批量更新
     *
     * @param list 数据实体列表
     */
    public Boolean modifyList(List<T> list) {
        List<BatchResult> batchResult = DB.updateById(list);
        // TODO 判断成功
        return Boolean.TRUE;
    }
    /**
     * 批量查询其他实体列表
     *
     * @param queryWrapper 查询条件
     */
    public <E> List<E> selectListObject(Wrapper<T> queryWrapper) {
        return DB.selectObjs(queryWrapper);
    }
    /**
     * 批量查询其他实体列表
     *
     * @param queryWrapper  查询条件
     * @param resultHandler 查询结果处理器
     */
    public <E> void selectListObject(Wrapper<T> queryWrapper, ResultHandler<E> resultHandler) {
        DB.selectObjs(queryWrapper, resultHandler);
    }
    /**
     * 根据条件获取数据实体列表
     * 根据主键查询单个数据实体
     *
     * @param queryWrapper 查询条件
     * @param id 主键值
     */
    @Transactional(readOnly = true)
    protected List<T> getList(Wrapper<T>... queryWrapper) {
        return DB.selectList(queryWrapper.length > 0 ? queryWrapper[0] : null);
    public T get(Serializable id) {
        return DB.selectById(id);
    }
    /**
@@ -149,8 +309,7 @@
     *
     * @param queryWrapper 查询条件
     */
    @Transactional(readOnly = true)
    protected T get(Wrapper<T> queryWrapper) {
    public T get(Wrapper<T> queryWrapper) {
        String method = "BasicDao.Wrapper<T> queryWrapper";
        try {
            return DB.selectOne(queryWrapper);
@@ -163,6 +322,20 @@
        }
    }
    /**
     * 根据主键批量获取
     * @param listId 主键列表
     */
    public <E extends Serializable> List<T> getList(List<E> listId) {
        return DB.selectBatchIds(listId);
    }
    /**
     * 获取全量数据(慎重)
     */
    public List<T> getList() {
        return DB.selectList(null);
    }
    /**
     * 根据传入sql查询数据
@@ -188,7 +361,7 @@
     * @param id 主键id
     * @return 是否成功
     */
    public Boolean remove(Long id) {
    public Boolean remove(Serializable id) {
        int rowCount = DB.deleteById(id);
        if (rowCount > 0) {
            return Boolean.TRUE;
@@ -202,7 +375,7 @@
     * @param listId id列表
     * @return 是否成功
     */
    public Boolean remove(List<Long> listId) {
    public <E extends Serializable> Boolean remove(List<E> listId) {
        int rowCount = DB.deleteByIds(listId);
        if (rowCount > 0) {
            return Boolean.TRUE;
@@ -216,7 +389,7 @@
     *
     * @param queryWrapper 查询条件
     */
    protected Boolean remove(Wrapper<T> queryWrapper) {
    public Boolean remove(Wrapper<T> queryWrapper) {
        int rowCount = DB.delete(queryWrapper);
        if (rowCount > 0) {
            return Boolean.TRUE;
@@ -230,7 +403,7 @@
     * @param id 主键id
     * @return 是否成功
     */
    public Boolean deleteLogic(Long id) {
    public Boolean deleteLogic(Serializable id) {
        UpdateWrapper<T> where = Wrappers.update();
        where.set("is_delete", EYesOrNo.YES.getValue());
        where.eq("id", id);
@@ -247,7 +420,7 @@
     * @param listId id列表
     * @return 是否成功
     */
    public Boolean deleteLogic(List<Long> listId) {
    public <E extends Serializable> Boolean deleteLogic(List<E> listId) {
        UpdateWrapper<T> where = Wrappers.update();
        where.set("is_delete", EYesOrNo.YES.getValue());
        where.in("id", listId);
@@ -257,4 +430,12 @@
        }
        return Boolean.FALSE;
    }
    /**
     * 分页查询
     *
     * @param search 查询参数
     */
    @Override
    public abstract PagerResult<T> search(SearchBasicDTO search);
}
src/main/java/com/lunhan/xxx/repository/BasicPO.java
@@ -1,6 +1,23 @@
package com.lunhan.xxx.repository;
import javax.persistence.Id;
import java.io.Serializable;
public class BaiscDao implements Serializable {
/**
 * PO基类
 */
public class BasicPO implements Serializable {
    /**
     * 主键id
     */
    @Id
    private Long id;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
}
src/main/java/com/lunhan/xxx/repository/imapper/TestInfoMapper.java
@@ -1,4 +1,31 @@
package com.lunhan.xxx.repository.imapper;
public interface TestInfoMapper {
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.lunhan.xxx.entity.dto.search.SearchTestInfo;
import com.lunhan.xxx.repository.BasicMapper;
import com.lunhan.xxx.repository.po.TestInfoPO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
public interface TestInfoMapper extends BasicMapper<TestInfoPO> {
    // #{param}:会进行预编译,而且进行类型匹配,最后进行变量替换,括号中可以添加映射类型如
//    @Select(
//        "<script>" +
//        "select * from student where id= #{param,javaType=int,jdbcType=NUMERIC}" +
//        "</script> "
//    )
    // ${param}:$只是只是简单的字符串拼接,要特别小心sql注入问题,对应非变量部分,只能用$。$方式一般用于传入数据库对象,比如这种group by 字段 ,order by 字段,表名,字段名等没法使用占位符的就需要使用${param}
    @Select("select * from test_info where id = #{id}")
    TestInfoPO testGet(Long id);
    @Select("select * from test_info where id = #{userName}")
    TestInfoPO testGet2(String userName);
    @Select("select * from test_info where status = #{ew.status}")
    TestInfoPO testGet3(@Param(Constants.WRAPPER) SearchTestInfo search);
    @Select("select * from test_info where status = #{search.status}")
    TestInfoPO testGet4(@Param("search") SearchTestInfo search);
}
src/main/java/com/lunhan/xxx/repository/mapper/TestInfoMapperImpl.java
@@ -20,7 +20,7 @@
#                  神兽保佑
#                  永无BUG!
*/
package com.lunhan.xxx.repository.dao;
package com.lunhan.xxx.repository.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -30,13 +30,13 @@
import com.lunhan.xxx.common.util.NumericUtil;
import com.lunhan.xxx.common.util.StringUtil;
import com.lunhan.xxx.entity.dto.OrderByDTO;
import com.lunhan.xxx.entity.dto.SearchBasicDTO;
import com.lunhan.xxx.entity.dto.search.SearchTestInfo;
import com.lunhan.xxx.entity.enums.EOrderBy;
import com.lunhan.xxx.repository.BasicDao;
import com.lunhan.xxx.repository.BasicMapperImpl;
import com.lunhan.xxx.repository.imapper.TestInfoMapper;
import com.lunhan.xxx.repository.po.TestInfoPO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * 测试信息 数据访问类
@@ -46,16 +46,15 @@
 */
@Repository
public class TestInfoDao extends BasicDao<TestInfoPO> {
//    TestInfoDao() {
//        super(ETestInfo.values());
//    }
    public Boolean removeByListId(List<Long> listId) {
        return super.deleteLogic(listId);
class TestInfoMapperImpl extends BasicMapperImpl<TestInfoPO> {
    public TestInfoMapperImpl(TestInfoMapper mapper) {
        super(mapper);
    }
    public PagerResult<TestInfoPO> search(SearchTestInfo search) {
    @Override
    public PagerResult<TestInfoPO> search(SearchBasicDTO request) {
        // 还原查询条件真实类型
        SearchTestInfo search = (SearchTestInfo)request;
        // 查询条件
        LambdaQueryWrapper<TestInfoPO> queryWrapper = this.query();
        // 非逻辑删除
@@ -118,10 +117,7 @@
        } else {
            queryWrapper.orderByDesc(TestInfoPO::getId);
        }
        return super.getPageList(new Page<>(search.getPage(), search.getLimit()), queryWrapper);
    }
    public List<TestInfoPO> getListById(List<Long> listId) {
        return super.db.selectBatchIds(listId);
        Page<TestInfoPO> pageResult = DB.selectPage(new Page<>(search.getPage(), search.getLimit()), queryWrapper);
        return new PagerResult<>(pageResult.getSize(), pageResult.getPages(), pageResult.getTotal(), pageResult.getRecords());
    }
}
src/main/java/com/lunhan/xxx/repository/po/TestInfoPO.java
@@ -22,8 +22,9 @@
*/
package com.lunhan.xxx.repository.po;
import com.lunhan.xxx.repository.BasicPO;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
@@ -36,13 +37,7 @@
@Entity
@Table(name = "test_info")
public class TestInfoPO implements Serializable {
    /**
     * 自增id
     */
    @Id
    @Column(name = "id")
    private Long id;
public class TestInfoPO extends BasicPO {
    /**
     * 名称
     */
@@ -96,15 +91,14 @@
    /**
     * 数据最后更新时间
     */
    @Column(name = "datachange_lasttime", insertable = false, updatable = false)
    private Timestamp dataChangeLastTime;
    @Column(name = "update_time", insertable = false, updatable = false)
    private Timestamp updateTime;
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    /**
     * 是否删除(逻辑删除)
     */
    @Column(name = "is_delete")
    private Integer isDelete;
    public String getName() {
        return this.name;
@@ -176,10 +170,19 @@
        this.createTime = createTime;
    }
    public Timestamp getDataChangeLastTime() {
        return this.dataChangeLastTime;
    public Timestamp getUpdateTime() {
        return updateTime;
    }
    public void setDataChangeLastTime(Timestamp dataChangeLastTime) {
        this.dataChangeLastTime = dataChangeLastTime;
    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getIsDelete() {
        return isDelete;
    }
    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }
}
src/main/java/com/lunhan/xxx/repository/vo/TestInfoVO.java
@@ -18,9 +18,9 @@
    @Override
    public String getUpdateTimeView() {
        if (Objects.isNull(this.getDataChangeLastTime())) {
        if (Objects.isNull(this.getUpdateTime())) {
            return "";
        }
        return LocalDateTimeUtil.toFormatFullString(this.getDataChangeLastTime());
        return LocalDateTimeUtil.toFormatFullString(this.getUpdateTime());
    }
}
src/main/java/com/lunhan/xxx/service/TestInfoService.java
@@ -10,10 +10,10 @@
import com.lunhan.xxx.entity.request.ReqSetSort;
import com.lunhan.xxx.entity.request.test.ReqCreateTestInfo;
import com.lunhan.xxx.entity.request.test.ReqModifyTestInfo;
import com.lunhan.xxx.repository.dao.TestInfoDao;
import com.lunhan.xxx.repository.imapper.TestInfoMapper;
import com.lunhan.xxx.repository.po.TestInfoPO;
import com.lunhan.xxx.repository.vo.TestInfoVO;
import com.lunhan.xxx.service.convert.TestInfoMapper;
import com.lunhan.xxx.service.convert.TestInfoConvert;
import org.apache.commons.lang3.BooleanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -27,19 +27,19 @@
@Service
public class TestInfoService extends BaseService {
    @Autowired
    private TestInfoDao dao;
    private TestInfoMapper mapper;
    public ExecutedResult<Long> create(ReqCreateTestInfo request) {
        // 转换po
        TestInfoPO item = TestInfoMapper.INSTANCE.toCreate(request);
        TestInfoPO item = TestInfoConvert.INSTANCE.toCreate(request);
        item.setId(SnowFlakeUtil.getId());
        // 设置状态
        item.setStatus(EState.NORMAL.getValue());
        // 设置记录创建时间
        item.setCreateTime(LocalDateTimeUtil.nowTimeStamp());
        Boolean result = this.dao.addNotIncrement(item);
        if (BooleanUtils.isFalse(result)) {
        int rowCount = mapper.insert(item);
        if (rowCount != 1) {
            return ExecutedResult.failed("创建[测试信息]失败。");
        }
        return ExecutedResult.success(item.getId());
@@ -53,10 +53,10 @@
        }
        // 转换po
        TestInfoPO item = TestInfoMapper.INSTANCE.toModify(request);
        TestInfoPO item = TestInfoConvert.INSTANCE.toModify(request);
        Boolean result = this.dao.modify(item);
        if (BooleanUtils.isFalse(result)) {
        int rowCount = mapper.updateById(item);
        if (rowCount != 1) {
            return ExecutedResult.failed("编辑[测试信息]失败。");
        }
        return ExecutedResult.success();
@@ -65,9 +65,9 @@
    public ExecutedResult<TestInfoVO> get(Long id) {
        TestInfoVO result = new TestInfoVO();
        TestInfoPO find = dao.getById(id);
        TestInfoPO find = mapper.selectById(id);
        if (null != find) {
            result = TestInfoMapper.INSTANCE.toVo(find);
            result = TestInfoConvert.INSTANCE.toVo(find);
        }
        return ExecutedResult.success(result);
    }
@@ -83,8 +83,8 @@
        item.setId(id);
        item.setStatus(EState.DISABLED.getValue());
        Boolean result = this.dao.modify(item);
        if (BooleanUtils.isFalse(result)) {
        int rowCount = mapper.updateById(item);
        if (rowCount != 1) {
            return ExecutedResult.failed("停用[测试信息]失败。");
        }
        return ExecutedResult.success();
@@ -101,8 +101,8 @@
        item.setId(id);
        item.setStatus(EState.NORMAL.getValue());
        Boolean result = this.dao.modify(item);
        if (BooleanUtils.isFalse(result)) {
        int rowCount = mapper.updateById(item);
        if (rowCount != 1) {
            return ExecutedResult.failed("启用[测试信息]失败。");
        }
        return ExecutedResult.success();
@@ -119,8 +119,8 @@
        item.setId(request.getId());
        item.setSort(request.getSort());
        Boolean result = this.dao.modify(item);
        if (BooleanUtils.isFalse(result)) {
        int rowCount = mapper.updateById(item);
        if (rowCount != 1) {
            return ExecutedResult.failed("[测试信息]设置排序值失败。");
        }
        return ExecutedResult.success();
@@ -143,7 +143,7 @@
                    return item;
                })
                .collect(Collectors.toList());
        Boolean result = dao.modifyList(listUpdate);
        Boolean result = mapper.modifyList(listUpdate);
        if (result) {
            return ExecutedResult.success();
        }
@@ -157,7 +157,7 @@
            return ExecutedResult.failed(checkExists.getMsg());
        }
        Boolean result = this.dao.deleteLogic(id);
        Boolean result = mapper.deleteLogic(id);
        if (BooleanUtils.isFalse(result)) {
            return ExecutedResult.failed("删除[测试信息]失败。");
        }
@@ -171,7 +171,7 @@
            return ExecutedResult.failed(checkExists.getMsg());
        }
        Boolean result = this.dao.deleteLogic(listId);
        Boolean result = mapper.deleteLogic(listId);
        if (BooleanUtils.isFalse(result)) {
            return ExecutedResult.failed("删除[测试信息]失败。");
        }
@@ -181,7 +181,7 @@
    public ExecutedResult<List<TestInfoVO>> getList(List<Long> listId) {
        List<TestInfoVO> result = new ArrayList<>();
        List<TestInfoPO> list = this.dao.getListById(listId);
        List<TestInfoPO> list = mapper.getList(listId);
        if (ListUtil.isNotNullOrEmpty(list)) {
            result = CopierUtil.mapTo(list, TestInfoVO.class);
        }
@@ -198,13 +198,13 @@
            search.setCreateTimeEnd(LocalDateTimeUtil.getTimeStamp(createTimeRange.getItem2()).getTime());
        }
        PagerResult<TestInfoPO> pageList = dao.search(search);
        PagerResult<TestInfoPO> pageList = mapper.search(search);
        List<TestInfoVO> listVo = new ArrayList<>();
        List<TestInfoPO> list = pageList.getList();
        if (ListUtil.isNotNullOrEmpty(list)) {
            pageList.setLastId(list.get(list.size() - 1).getId());
            // 转换vo
            listVo = TestInfoMapper.INSTANCE.toVo(list);
            listVo = TestInfoConvert.INSTANCE.toVo(list);
        }
        PagerResult<TestInfoVO> result = new PagerResult<>(pageList.getLimit(), pageList.getPage(), pageList.getTotal(), listVo);
        result.setLastId(pageList.getLastId());
@@ -212,7 +212,7 @@
    }
    protected ExecutedResult<TestInfoPO> check4Id(Long id) {
        TestInfoPO exists = dao.getById(id);
        TestInfoPO exists = mapper.get(id);
        if (Objects.isNull(exists)) {
            return ExecutedResult.failed("[测试信息]不存在:" + id);
        }
@@ -220,7 +220,7 @@
    }
    protected ExecutedResult<List<TestInfoPO>> check4Id(List<Long> listId) {
        // 从数据库查找类别
        List<TestInfoPO> list = dao.getListById(listId);
        List<TestInfoPO> list = mapper.getList(listId);
        if (ListUtil.isNullOrEmpty(list)) {
            return ExecutedResult.failed("[测试信息]不存在." + listId);
        }
@@ -236,8 +236,9 @@
        }
        return ExecutedResult.success(list);
    }
    protected Map<Long, TestInfoPO> getMap4Id(List<Long> listId) {
        List<TestInfoPO> list = this.dao.getListById(listId);
        List<TestInfoPO> list = mapper.getList(listId);
        if (ListUtil.isNullOrEmpty(list)) {
            return new HashMap<>(0);
        }
src/main/java/com/lunhan/xxx/service/convert/TestInfoConvert.java
@@ -37,8 +37,8 @@
 * @description 水表账户停用启用申请表
 */
@Mapper
public interface TestInfoMapper {
    TestInfoMapper INSTANCE = Mappers.getMapper(TestInfoMapper.class);
public interface TestInfoConvert {
    TestInfoConvert INSTANCE = Mappers.getMapper(TestInfoConvert.class);
    TestInfoPO toCreate(ReqCreateTestInfo request);
    TestInfoPO toModify(ReqModifyTestInfo request);
src/test/java/com/lunhan/xxx/host/GenCodeGauss.java
@@ -28,18 +28,16 @@
    //region 输出文件路径设置
    class OutSet {
        public static final String PO = "./src/main/java/com/lunhan/water/repository/po/";
        public static final String VO = "./src/main/java/com/lunhan/water/repository/vo/";
        public static final String COMVERT_MAPPER = "./src/main/java/com/lunhan/water/service/convert/";
        public static final String COLUMNS_ENUM = "./src/main/java/com/lunhan/water/repository/columns/";
        public static final String DAO = "./src/main/java/com/lunhan/water/repository/dao/";
        public static final String MAPPER = "./src/main/java/com/lunhan/water/repository/";
        public static final String MAPPERXML = "./src/main/resources/mapper/";
        public static final String SERVICE = "./src/main/java/com/lunhan/water/service/";
        public static final String Controller = "./src/main/java/com/lunhan/water/host/controller/";
        public static final String SEARCH = "./src/main/java/com/lunhan/water/entity/dto/search/";
        public static final String RequestDTO = "./src/main/java/com/lunhan/water/entity/request/";
        public static final String ResponseDTO = "./src/main/java/com/lunhan/water/entity/response/";
        public static final String PO = "./src/main/java/com/lunhan/xxx/repository/po/";
        public static final String VO = "./src/main/java/com/lunhan/xxx/repository/vo/";
        public static final String CONVERT_MAPPER = "./src/main/java/com/lunhan/xxx/service/convert/";
        public static final String MAPPER_IMPL = "./src/main/java/com/lunhan/xxx/repository/mapper/";
        public static final String MAPPER = "./src/main/java/com/lunhan/xxx/repository/imapper/";
        public static final String SERVICE = "./src/main/java/com/lunhan/xxx/service/";
        public static final String Controller = "./src/main/java/com/lunhan/xxx/host/controller/";
        public static final String SEARCH = "./src/main/java/com/lunhan/xxx/entity/dto/search/";
        public static final String RequestDTO = "./src/main/java/com/lunhan/xxx/entity/request/";
        public static final String ResponseDTO = "./src/main/java/com/lunhan/xxx/entity/response/";
    }
    //endregion
@@ -48,9 +46,8 @@
        public static final String PO = "com.lunhan.xxx.repository.po";
        public static final String VO = "com.lunhan.xxx.repository.vo";
        public static final String CONVERT_MAPPER = "com.lunhan.xxx.service.convert";
        public static final String DAO = "com.lunhan.xxx.repository.dao";
        public static final String COLUMNS_ENUM = "com.lunhan.xxx.repository.columns";
        public static final String MAPPER = "com.lunhan.xxx.repository";
        public static final String MAPPER_IMPL = "com.lunhan.xxx.repository.mapper";
        public static final String MAPPER = "com.lunhan.xxx.repository.imapper";
        public static final String SERVICE = "com.lunhan.xxx.service";
        public static final String Controller = "com.lunhan.xxx.host.controller";
        public static final String SEARCH = "com.lunhan.xxx.entity.dto.search";
@@ -63,8 +60,8 @@
    class SuffixSet {
        public static final String PO = "PO";
        public static final String VO = "VO";
        public static final String COLUMNS_ENUM = "";//POColumns
        public static final String DAO = "Dao";
        public static final String CONVERT_MAPPER = "Convert";
        public static final String MAPPER_IMPL = "MapperImpl";
        public static final String MAPPER = "Mapper";
        public static final String SERVICE = "Service";
        public static final String Controller = "Controller";
@@ -110,6 +107,8 @@
    //region po类 import 内容设置
    private static final String[] SET_PO_IMPORT = new String[]{
            "import com.lunhan.xxx.repository.BasicPO;",
            "",
            "import javax.persistence.*;",
            "import java.io.Serializable;",
            "import java.sql.Timestamp;"
@@ -143,16 +142,18 @@
    //region dao类 import 内容设置
    private static final String[] SET_DAO_IMPORT = new String[]{
            "import com.lunhan.xxx.common.ConstantFactory;",
            "import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;",
            "import com.baomidou.mybatisplus.extension.plugins.pagination.Page;",
            "import com.lunhan.xxx.common.PagerResult;",
            "import com.lunhan.xxx.common.orm2.SqlBuilder;",
            "import com.lunhan.xxx.common.util.*;",
            "import com.lunhan.xxx.common.enums.EYesOrNo;",
            "import com.lunhan.xxx.common.util.ListUtil;",
            "import com.lunhan.xxx.common.util.NumericUtil;",
            "import com.lunhan.xxx.common.util.StringUtil;",
            "import com.lunhan.xxx.entity.dto.OrderByDTO;",
            "import com.lunhan.xxx.entity.enums.*;",
            "import com.lunhan.xxx.repository.BasicDao;",
            "import org.springframework.stereotype.Repository;",
            "import java.util.*;",
            "import org.springframework.transaction.annotation.Transactional;"
            "import com.lunhan.xxx.entity.dto.SearchBasicDTO;",
            "import com.lunhan.xxx.entity.enums.EOrderBy;",
            "import com.lunhan.xxx.repository.BasicMapperImpl;",
            "import org.springframework.stereotype.Repository;"
    };
    //endregion
@@ -268,17 +269,15 @@
            List<Map<String, Object>> columns = getColumns(tableName, DB_NAME);
            genPO(columns, tableDesc);
            genVO(columns, tableDesc);
            genColumnsEnum(columns, tableDesc);
            genCreateDto(columns, tableName, tableDesc);
            genSearch(columns, tableDesc);
            genMapper(columns, tableDesc);
            genModifyDto(columns, tableName, tableDesc);
            genDao(tableName, tableDesc);
            genSearch(columns, tableDesc);
            genConvertMapper(tableName, tableDesc);
            genService(tableName, tableDesc);
            genController(tableName, tableDesc);
            //genMapperXml(columns, tableDesc);
            //genMapper(columns, tableDesc);
        }
    }
@@ -531,107 +530,10 @@
        writeFile(GenCodeGauss.OutSet.SEARCH + "/", searchName + ".java", content.toString());
    }
    private static void genColumnsEnum(List<Map<String, Object>> columns, String tableDesc) {
        if (ListUtil.isNullOrEmpty(columns)) {
            return;
        }
        String tableName = columns.get(0).get("objname").toString();
        String modelName = underline2Camel(tableName, true);
        String enumName = "E" + modelName + GenCodeGauss.SuffixSet.COLUMNS_ENUM;
        StringBuilder content = new StringBuilder();
        content.append(SET_BEFORE_TEXT);
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("package ");
        content.append(GenCodeGauss.PackageSet.COLUMNS_ENUM);
        content.append(ConstantFactory.STR_SEMICOLON);
        content.append(ConstantFactory.STR_NEWLINE);
        if (SET_COLUMNS_ENUM_IMPORT.length > 0) {
            content.append(ConstantFactory.STR_NEWLINE);
            for (String s : SET_COLUMNS_ENUM_IMPORT) {
                content.append(s);
                content.append(ConstantFactory.STR_NEWLINE);
            }
        }
        content.append(ConstantFactory.STR_NEWLINE);
        content.append(SET_CLASS_DESC_TPL
                .replaceAll("\\{\\#\\=desc\\}", tableDesc)
                .replaceAll("\\{\\#\\=author\\}", AUTHOR)
                .replaceAll("\\{\\#\\=date\\}", LocalDateTimeUtil.todayStr().replaceAll("\\-", "/"))
        );
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("public enum ");
        content.append(enumName);
        content.append(" implements ColumnBasic {");
        List<String> listColumn = new ArrayList<>();
        String lastStr = "";
        int idx = 0;
        for (Map<String, Object> column : columns) {
            idx++;
            String name = column.get("name").toString();
            String desc = String.valueOf(column.get("description"));
            String type = column.get("type").toString();
            int length = NumericUtil.tryParseInt(column.get("length"), 0);
            String defValue = String.valueOf(column.get("default"));
            int isPK = NumericUtil.tryParseInt(column.get("isPK"), 0);
            int isIdentity = NumericUtil.tryParseInt(column.get("isIdentity"), 0);
            int isNullable = NumericUtil.tryParseInt(column.get("isNullable"), 0);
            String propName = underline2Camel(name);
            listColumn.add(SET_PRO_DESC_TPL.replaceAll("\\{\\#\\=desc\\}", desc));
            String str = String.format("\t%s(\"%s\", %s),", name.toUpperCase(), name, idx);
            //追加列
            listColumn.add(str);
            lastStr = str;
        }
        content.append(ConstantFactory.STR_NEWLINE);
        content.append(StringUtil.join(listColumn, ConstantFactory.STR_NEWLINE).replace(lastStr, lastStr.replace("),", ");")));
        content.append(ConstantFactory.STR_NEWLINE);
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("\tprivate String columnName;\n");
        content.append("\tprivate Integer value;\n");
        content.append("\tpublic Integer getValue() {\n");
        content.append("\t\treturn value;\n");
        content.append("\t}\n");
        content.append("\tpublic String getColumnName() {\n");
        content.append("\t\treturn columnName;\n");
        content.append("\t}\n");
        content.append("\tstatic final String TABLE_NAME = \"" + tableName + "\";\n");
        content.append("\tpublic String getTableName() {\n");
        content.append("\t\treturn TABLE_NAME;\n");
        content.append("\t}\n");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("\t");
        content.append(enumName);
        content.append("(String columnName, Integer value) {\n");
        content.append("\t\tthis.columnName = columnName;\n");
        content.append("\t\tthis.value = value;\n");
        content.append("\t}\n");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("\tpublic static " + enumName + " getByValue(Integer value) {\n");
        content.append("\t\treturn Arrays.stream(" + enumName + ".values())\n");
        content.append("\t\t\t\t.filter(e -> Objects.equals(e.getValue(), value))\n");
        content.append("\t\t\t\t.findAny()\n");
        content.append("\t\t\t\t.orElse(null);\n");
        content.append("\t}\n");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("\t@Override\n");
        content.append("\tpublic String toString() {\n");
        content.append("\t\treturn \"" + enumName + "{\" +\n");
        content.append("\t\t\t\t\"columnName='\" + columnName + '\\'' +\n");
        content.append("\t\t\t\t\", value=\" + value +\n");
        content.append("\t\t\t\t'}';\n");
        content.append("\t}\n");
        content.append("}");
        writeFile(GenCodeGauss.OutSet.COLUMNS_ENUM, enumName + ".java", content.toString());
    }
    private static void genDao(String tableName, String tableDesc) {
        String modelName = underline2Camel(tableName, true);
        String daoName = modelName + GenCodeGauss.SuffixSet.DAO;
        String mapperName = modelName + SuffixSet.MAPPER;
        String daoName = modelName + GenCodeGauss.SuffixSet.MAPPER_IMPL;
        String poName = modelName + GenCodeGauss.SuffixSet.PO;
        String enumName = "E" + modelName;
        String searchName = "Search" + modelName;
@@ -641,7 +543,7 @@
        content.append(SET_BEFORE_TEXT);
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("package ");
        content.append(GenCodeGauss.PackageSet.DAO);
        content.append(GenCodeGauss.PackageSet.MAPPER_IMPL);
        content.append(ConstantFactory.STR_SEMICOLON);
        content.append(ConstantFactory.STR_NEWLINE);
        if (SET_DAO_IMPORT.length > 0) {
@@ -652,16 +554,16 @@
            }
        }
        content.append("import ");
        content.append(GenCodeGauss.PackageSet.COLUMNS_ENUM);
        content.append(GenCodeGauss.PackageSet.SEARCH + ".");
        content.append(searchName + ";\n");
        content.append("import ");
        content.append(PackageSet.MAPPER);
        content.append(".");
        content.append("E" + modelName + GenCodeGauss.SuffixSet.COLUMNS_ENUM + ";\n");
        content.append(mapperName + ";\n");
        content.append("import ");
        content.append(GenCodeGauss.PackageSet.PO);
        content.append(".");
        content.append(poName + ";\n");
        content.append("import ");
        content.append(GenCodeGauss.PackageSet.SEARCH + ".");
        content.append(searchName + ";\n");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append(SET_CLASS_DESC_TPL
                .replaceAll("\\{\\#\\=desc\\}", tableDesc)
@@ -672,98 +574,89 @@
        content.append("@Repository\n");
        content.append("public class ");
        content.append(daoName);
        content.append(" extends BasicDao<");
        content.append(" extends BasicMapperImpl<");
        content.append(modelName + GenCodeGauss.SuffixSet.PO);
        content.append("> {");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("\t" + daoName + "() {\n");
        content.append("\t\tsuper(E" + modelName + GenCodeGauss.SuffixSet.COLUMNS_ENUM + ".values());\n");
        content.append("\t" + daoName + "(" + mapperName + " mapper) {\n");
        content.append("\t\tsuper(mapper);\n");
        content.append("\t}\n");
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("    /**\n" +
                "     * 批量删除数据\n" +
                "     * @param listId 主键id列表\n" +
                "     * @return 是否成功\n" +
                "     */\n" +
                "     public Boolean removeByListId(List<Long> listId) {\n" +
                "          return super.remove(new SqlBuilder().where(" + enumName + ".ID.in(listId)));\n" +
                "     }\n\n");
        content.append("    /**\n" +
                "     * 根据主键获取数据列表\n" +
                "     * @param listId 主键id列表\n" +
                "     * @return 数据实体\n" +
                "     */\n" +
                "    @Transactional(readOnly = true)\n" +
                "    public List<" + poName + "> getListById(List<Long> listId) {\n" +
                "        return super.getList(new SqlBuilder()\n" +
                "            .where(" + enumName + ".ID.in(listId))\n" +
                "        );\n" +
                "    }\n\n");
        content.append("\tpublic PagerResult<" + poName + "> search(" + searchName + " search) {\n" +
                "\t\tSqlBuilder builder = new SqlBuilder()\n" +
                "\t\t\t\t// 分页参数\n" +
                "\t\t\t\t.page(NumericUtil.tryParseInt(search.getPage(), 1), NumericUtil.tryParseInt(search.getLimit(), 1))\n" +
        content.append("\t@Override\n" +
                "\tpublic PagerResult<" + poName + "> search(" + searchName + " request) {\n" +
                "\t\t// 还原查询条件真实类型\n" +
                "\t\t" + searchName + " search = (" + searchName + ")request;\n" +
                "\t\t// 查询条件\n" +
                "\t\tLambdaQueryWrapper<" + poName + "> queryWrapper = this.query();\n" +
                "\t\t// 非逻辑删除\n" +
                "\t\tqueryWrapper.eq(" + poName + "::getIsDelete, EYesOrNo.NO.getValue());\n" +
                "\t\t// 状态\n" +
                "\t\t//queryWrapper.eq(NumericUtil.tryParseInt(search.getStatus()).compareTo(0) > 0, " + poName + "::getStatus, search.getStatus());\n" +
                "\t\t// 状态列表\n" +
                "\t\t//queryWrapper.in(ListUtil.isNotNullOrEmpty(search.getListStatus()), " + poName + "::getStatus, search.getListStatus());\n" +
                "\n" +
                "\t\t\t\t// 数据非逻辑删除\n" +
                "\t\t\t\t//.and(" + enumName + ".IS_DELETE.equal(EYesOrNo.NO.getValue()))\n" +
                "\t\t\t\t// 状态非删除状态\n" +
                "\t\t\t\t//.and(" + enumName + ".STATUS.notEqual(EState.DELETED.getValue()))\n" +
                "\t\t// 数据创建时间-起始\n" +
                "\t\tqueryWrapper.ge(NumericUtil.tryParseLong(search.getCreateTimeStart()).compareTo(0L) > 0, " + poName + "::getCreateTime, search.getCreateTimeStart());\n" +
                "\t\t// 数据创建时间-截止\n" +
                "\t\tqueryWrapper.le(NumericUtil.tryParseLong(search.getCreateTimeEnd()).compareTo(0L) > 0, " + poName + "::getCreateTime, search.getCreateTimeEnd());\n" +
                "\t\t// 关键字\n" +
                "\t\tif (StringUtil.isNotNullOrEmpty(search.getKeywords())) {\n" +
                "\t\t\tqueryWrapper.and(q ->\n" +
                "\t\t\t\tq.like(" + poName + "::getName, search.getKeywords())\n" +
                "\t\t\t\t.or().like(" + poName + "::getPhone, search.getKeywords())\n" +
                "\t\t\t);\n" +
                "\t\t}\n" +
                "\n" +
                "\t\t\t\t// 状态\n" +
                "\t\t\t\t//.andIf(NumericUtil.tryParseInt(search.getStatus()).compareTo(0) > 0, " + enumName + ".STATUS.equal(search.getStatus()))\n" +
                "\t\t\t\t// 状态列表\n" +
                "\t\t\t\t//.andIf(ListUtil.isNotNullOrEmpty(search.getListStatus()), " + enumName + ".STATUS.in(search.getListStatus()))\n" +
                "\t\t\t\t// id列表\n" +
                "\t\t\t\t.andIf(ListUtil.isNotNullOrEmpty(search.getListId()), " + enumName + ".ID.in(search.getListId()))\n" +
                "\t\t\t\t// 关键字\n" +
                "\t\t\t\t//.andIf(StringUtil.isNotNullOrEmpty(search.getKeywords()), " + enumName + ".NAME.like(search.getKeywords()))\n" +
                "\t\t\t\t// 创建时间-起始\n" +
                "\t\t\t\t.andIf(NumericUtil.tryParseLong(search.getCreateTimeStart()).compareTo(0L) > 0, " + enumName + ".CREATE_TIME.greaterOrEqual(search.getCreateTimeStart()))\n" +
                "\t\t\t\t// 创建时间-截止\n" +
                "\t\t\t\t.andIf(NumericUtil.tryParseLong(search.getCreateTimeEnd()).compareTo(0L) > 0, " + enumName + ".CREATE_TIME.lessOrEqual(search.getCreateTimeEnd()))\n" +
                "\t\t\t\t;\n" +
                "\t\t// 排序处理\n" +
                "\t\tif (ListUtil.isNotNullOrEmpty(search.getOrderBy())) {\n" +
                "\t\t\tList<String> listOrderBy = new ArrayList<>();\n" +
                "\t\t\tfor (OrderByDTO item : search.getOrderBy()) {\n" +
                "\t\t\t\tEOrderBy orderBy = EOrderBy.getByValue(NumericUtil.tryParseInt(item.getOrderBy(), 1));\n" +
                "\t\t\t\tif (Objects.isNull(orderBy)) {\n" +
                "\t\t\t\t\tcontinue;\n" +
                "\t\t\t\t}\n" +
                "\t\t\t\tswitch (orderBy) {\n" +
                "\t\t\t\t\tcase ID:\n" +
                "\t\t\t\t\t\tlistOrderBy.add(" + enumName + ".ID.getColumnName() +\n" +
                "\t\t\t\t\t\t\t\t(item.getIsAsc() ? ConstantFactory.SQL_ASC : ConstantFactory.SQL_DESC)\n" +
                "\t\t\t\t\t\t);\n" +
                "\t\t\t\t\t\tbreak;\n" +
                "\n" +
                "\t\t\t\t\tcase CREATE_TIME:\n" +
                "\t\t\t\t\t\tlistOrderBy.add(" + enumName + ".CREATE_TIME.getColumnName() +\n" +
                "\t\t\t\t\t\t\t\t(item.getIsAsc() ? ConstantFactory.SQL_ASC : ConstantFactory.SQL_DESC)\n" +
                "\t\t\t\t\t\t);\n" +
                "\t\t\t\t\t\tbreak;\n" +
                "\n" +
                "\t\t\t\t\tcase UPDATE_TIME:\n" +
                "\t\t\t\t\t\tlistOrderBy.add(" + enumName + ".UPDATE_TIME.getColumnName() +\n" +
                "\t\t\t\t\t\t\t\t(item.getIsAsc() ? ConstantFactory.SQL_ASC : ConstantFactory.SQL_DESC)\n" +
                "\t\t\t\t\t\t);\n" +
                "\t\t\t\t\t\tbreak;\n" +
                "\n" +
                "\t\t\t\t\tdefault:\n" +
                "\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\tEOrderBy orderBy = EOrderBy.getByValue(item.getOrderBy());\n" +
                "\t\t\t\t// 顺序排序\n" +
                "\t\t\t\tif (item.getIsAsc()) {\n" +
                "\t\t\t\t\tswitch (orderBy) {\n" +
                "\t\t\t\t\t\t// 主键\n" +
                "\t\t\t\t\t\tcase ID:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getId);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t\t// 数据创建时间\n" +
                "\t\t\t\t\t\tcase CREATE_TIME:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getCreateTime);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t\t// 最后更新时间\n" +
                "\t\t\t\t\t\tcase UPDATE_TIME:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getUpdateTime);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t}\n" +
                "\t\t\t\t} else {\n" +
                "\t\t\t\t\t// 倒叙排序\n" +
                "\t\t\t\t\tswitch (orderBy) {\n" +
                "\t\t\t\t\t\t// 主键\n" +
                "\t\t\t\t\t\tcase ID:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getId);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t\t// 数据创建时间\n" +
                "\t\t\t\t\t\tcase CREATE_TIME:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getCreateTime);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t\t// 最后更新时间\n" +
                "\t\t\t\t\t\tcase UPDATE_TIME:\n" +
                "\t\t\t\t\t\t\tqueryWrapper.orderByAsc(" + poName + "::getUpdateTime);\n" +
                "\t\t\t\t\t\t\tbreak;\n" +
                "\t\t\t\t\t}\n" +
                "\t\t\t\t}\n" +
                "\t\t\t}\n" +
                "\t\t\tbuilder.orderBy(ListUtil.toArray(listOrderBy));\n" +
                "\t\t}else {\n" +
                "\t\t\tbuilder.orderBy(" + enumName + ".ID.getColumnName() + ConstantFactory.SQL_DESC);\n" +
                "\t\t}\n"+
                "\t\treturn super.getPageList(builder);\n" +
                "\t\t}");
                "\t\t} else {\n" +
                "\t\t\tqueryWrapper.orderByDesc(" + poName + "::getId);\n" +
                "\t\t}\n" +
                "\t\tPage<" + poName + "> pageResult = DB.selectPage(new Page<>(search.getPage(), search.getLimit()), queryWrapper);\n" +
                "\t\treturn new PagerResult<>(pageResult.getSize(), pageResult.getPages(), pageResult.getTotal(), pageResult.getRecords());\n" +
                "\t}");
        content.append("}");
        if (new File(GenCodeGauss.OutSet.DAO + daoName + ".java").exists()) {
        if (new File(GenCodeGauss.OutSet.MAPPER_IMPL + daoName + ".java").exists()) {
            return;
        }
        writeFile(GenCodeGauss.OutSet.DAO, daoName + ".java", content.toString());
        writeFile(GenCodeGauss.OutSet.MAPPER_IMPL, daoName + ".java", content.toString());
    }
    private static Boolean IsNoCreate(String name, Integer isPK, Integer isIdentity) {
@@ -970,7 +863,7 @@
        String voName = modelName + GenCodeGauss.SuffixSet.VO;
        String createDTOName = GenCodeGauss.SuffixSet.Create + modelName;
        String modifyDTOName = GenCodeGauss.SuffixSet.Modify + modelName;
        String convertMapperName = modelName + "Mapper";
        String convertMapperName = modelName + SuffixSet.CONVERT_MAPPER;
        String tableNamePackage = tableName.toLowerCase().replaceAll("_", "");
        StringBuilder content = new StringBuilder();
@@ -1030,17 +923,17 @@
        content.append(ConstantFactory.STR_NEWLINE);
        content.append("}");
        if (new File(GenCodeGauss.OutSet.COMVERT_MAPPER + convertMapperName + ".java").exists()) {
        if (new File(GenCodeGauss.OutSet.CONVERT_MAPPER + convertMapperName + ".java").exists()) {
            return;
        }
        writeFile(GenCodeGauss.OutSet.COMVERT_MAPPER, convertMapperName + ".java", content.toString());
        writeFile(GenCodeGauss.OutSet.CONVERT_MAPPER, convertMapperName + ".java", content.toString());
    }
    private static void genService(String tableName, String tableDesc) {
        String modelName = underline2Camel(tableName, true);
        String poName = modelName + GenCodeGauss.SuffixSet.PO;
        String serviceName = modelName + GenCodeGauss.SuffixSet.SERVICE;
        String daoName = modelName + GenCodeGauss.SuffixSet.DAO;
        String daoName = modelName + GenCodeGauss.SuffixSet.MAPPER_IMPL;
        String createDTOName = GenCodeGauss.SuffixSet.Create + modelName;
        String modifyDTOName = GenCodeGauss.SuffixSet.Modify + modelName;
        String responseDTOName = modelName + "VO";
@@ -1062,7 +955,7 @@
            }
        }
        content.append("import ");
        content.append(GenCodeGauss.PackageSet.DAO);
        content.append(GenCodeGauss.PackageSet.MAPPER_IMPL);
        content.append(".");
        content.append(daoName + ";\n");
        content.append("import ");
@@ -1417,110 +1310,6 @@
    //#region gen MyBatis mapper
    private static void genMapperXml(List<Map<String, Object>> columns, String tableDesc) {
        if (ListUtil.isNullOrEmpty(columns)) {
            return;
        }
        String tableName = columns.get(0).get("objname").toString();
        String modelName = underline2Camel(tableName, true);
        StringBuilder content = new StringBuilder();
        content.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                "<!DOCTYPE mapper\n" +
                "        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n" +
                "        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n");
        content.append("<!-- ");
        content.append(tableDesc);
        content.append(" mapper -->\n");
        content.append(String.format("<mapper namespace=\"%s.%s%s\">\n", GenCodeGauss.PackageSet.MAPPER, modelName, GenCodeGauss.SuffixSet.MAPPER));
        Map<String, String> mapResultMap = new HashMap<>();
        Map<String, String> mapResultMapDesc = new HashMap<>();
        for (Map<String, Object> column : columns) {
            String name = column.get("name").toString();
            String desc = String.valueOf(column.get("description"));
            String propName = underline2Camel(name);
            //忽略最后修改时间这一列的新增和编辑
            if ("datachange_lasttime".equalsIgnoreCase(name)) {
                propName = "dataChangeLastTime";
            }
            mapResultMap.put(name, propName);
            mapResultMapDesc.put(name, desc);
        }
        //追加 resultMap
        content.append(String.format("\t<resultMap type=\"%s.%s%s\" id=\"resultMap\">\n", GenCodeGauss.PackageSet.PO, modelName, GenCodeGauss.SuffixSet.PO));
        content.append(genResultMap(mapResultMap, mapResultMapDesc));
        content.append("\n\t</resultMap>\n\n");
        //追加 add 的方法
        content.append(String.format("\t<insert id=\"add\" parameterType=\"%s.%s%s\" keyProperty=\"id\" useGeneratedKeys=\"true\">\n", GenCodeGauss.PackageSet.PO, modelName, GenCodeGauss.SuffixSet.PO));
        content.append(genInsert(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</insert>\n\n");
        //追加 addBatch 的方法
        content.append(String.format("\t<insert id=\"addBatch\" parameterType=\"%s.%s%s\" useGeneratedKeys=\"true\" keyProperty=\"id\">\n", GenCodeGauss.PackageSet.PO, modelName, GenCodeGauss.SuffixSet.PO));
        content.append(genInsertBath(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</insert>\n\n");
        //追加 update 的方法
        content.append(String.format("\t<update id=\"update\" parameterType=\"%s.%s%s\" keyProperty=\"id\">\n", GenCodeGauss.PackageSet.PO, modelName, GenCodeGauss.SuffixSet.PO));
        content.append(genUpdate(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</update>\n\n");
        //追加 updateBatch 的方法
        content.append("\t<update id=\"updateBatch\" parameterType=\"java.util.List\">\n");
        content.append(genUpdateBatch(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</update>\n\n");
        //追加 delete 的方法
        content.append("\t<delete id=\"delete\">\n");
        content.append("\t\tDELETE FROM `");
        content.append(tableName);
        content.append("` WHERE `id` = #{value}\n");
        content.append("\t</delete>\n\n");
        //追加 deleteBatch 的方法
        content.append("\t<delete id=\"deleteBatch\" parameterType=\"java.util.List\">\n");
        content.append("\t\tDELETE FROM `");
        content.append(tableName);
        content.append("` WHERE `id` IN");
        content.append("\t\t<!-- “collection”固定值为list,“item”为循环变量取的别名 -->\n");
        content.append("\t\t<foreach collection=\"list\" item=\"id\" open=\"(\" separator=\",\" close=\")\">\n");
        content.append("\t\t\t#{id}\n");
        content.append("\t\t</foreach>\n");
        content.append("\t</delete>\n\n");
        //追加 get 的方法
        content.append("\t<select id=\"get\" resultMap=\"resultMap\">\n");
        content.append(genGet(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</select>\n\n");
        //追加 getCount 的方法
        content.append(String.format("\t<select id=\"getCount\" resultType=\"Long\" parameterType=\"%s.Search%s\">\n", GenCodeGauss.PackageSet.SEARCH, modelName));
        content.append(genGetCount(tableName));
        content.append("\n\t</select>\n\n");
        //追加 getList 的方法
        content.append(String.format("\t<select id=\"getList\" resultMap=\"resultMap\" parameterType=\"%s.Search%s\">\n", GenCodeGauss.PackageSet.SEARCH, modelName));
        content.append(genGetList(tableName, mapResultMap, mapResultMapDesc));
        content.append("\n\t</select>\n\n");
        //追加 getListBySql 的方法
        content.append("\t<select id=\"getListBySql\" parameterType=\"java.util.Map\" resultType=\"HashMap\">\n");
        content.append("\t\t${sql}\n");
        content.append("\t</select>\n");
        content.append("</mapper>");
        if (new File(GenCodeGauss.OutSet.MAPPERXML + modelName + GenCodeGauss.SuffixSet.MAPPER + ".xml").exists()) {
            return;
        }
        writeFile(GenCodeGauss.OutSet.MAPPERXML, modelName + GenCodeGauss.SuffixSet.MAPPER + ".xml", content.toString());
    }
    private static void genMapper(List<Map<String, Object>> columns, String tableDesc) {
        if (ListUtil.isNullOrEmpty(columns)) {
            return;
@@ -1551,230 +1340,6 @@
            return;
        }
        writeFile(GenCodeGauss.OutSet.MAPPER, modelName + GenCodeGauss.SuffixSet.MAPPER + ".java", content.toString());
    }
    private static String genInsert(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\tINSERT INTO `" + tableName + "`(");
        List<String> listColumn = new ArrayList<>();
        List<String> listValue = new ArrayList<>();
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            if (NO_CREATE_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) {
                continue;
            }
            listColumn.add("\t\t<!-- " + mapResultMapDesc.get(entry.getKey()) + " -->\n\t\t`" + name + "`");
            listValue.add("\t\t#{" + entry.getValue() + "}");
        }
        result.add(StringUtil.join(listColumn, ",\r\n"));
        result.add("\t\t) VALUES(");
        result.add(StringUtil.join(listValue, ",\r\n"));
        result.add("\t);");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genInsertBath(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\tINSERT INTO `" + tableName + "`(");
        List<String> listColumn = new ArrayList<>();
        List<String> listValue = new ArrayList<>();
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            if (NO_CREATE_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) {
                continue;
            }
            listColumn.add("\t\t<!-- " + mapResultMapDesc.get(entry.getKey()) + " -->\n\t\t`" + name + "`");
            listValue.add("\t\t\t#{item." + entry.getValue() + "}");
        }
        result.add(StringUtil.join(listColumn, ",\r\n"));
        result.add("\t\t) VALUES(");
        result.add("\t\t<!-- “collection”固定值为list,“item”为循环变量取的别名 -->");
        result.add("\t\t<foreach collection=\"list\" item=\"item\" separator=\",\">");
        result.add("\t\t\t(");
        result.add(StringUtil.join(listValue, ",\r\n"));
        result.add("\t\t\t)");
        result.add("\t\t</foreach>");
        result.add("\t\t);");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genUpdate(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\tUPDATE `" + tableName + "`");
        result.add("\t\t<trim prefix=\"SET\" suffixOverrides=\",\">");
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            String propName = entry.getValue();
            if (NO_UPDATE_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) {
                continue;
            }
            result.add("\t\t\t<!-- " + mapResultMapDesc.get(entry.getKey()) + " -->");
            result.add("\t\t\t<if test=\"null != " + propName + "\">`" + name + "` = #{" + propName + "},</if>");
        }
        result.add("\t\t</trim>");
        result.add("\t\tWHERE `id` = #{id}");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genUpdateBatch(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\t<!-- “collection”固定值为list,“item”为循环变量取的别名 -->");
        result.add("\t\t<foreach collection=\"list\" item=\"item\" index=\"index\" open=\"\" close=\"\" separator=\";\">");
        result.add("\t\t\tUPDATE `" + tableName + "`");
        result.add("\t\t\t<trim prefix=\"SET\" suffixOverrides=\",\">");
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            String propName = entry.getValue();
            if (NO_UPDATE_COLUMNS.stream().anyMatch(c -> c.equalsIgnoreCase(name))) {
                continue;
            }
            result.add("\t\t\t\t<!-- " + mapResultMapDesc.get(entry.getKey()) + " -->");
            result.add("\t\t\t\t<if test=\"null != item." + propName + "\">`" + name + "` = #{item." + propName + "},</if>");
        }
        result.add("\t\t\t</trim>");
        result.add("\t\t\tWHERE `id` = #{id}");
        result.add("\t\t</foreach>");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genGet(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\t<![CDATA[SELECT");
        List<String> listColumn = new ArrayList<>();
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            listColumn.add("\t\t\t`" + name + "`");
        }
        result.add(StringUtil.join(listColumn, ",\r\n"));
        result.add("\t\tFROM `" + tableName + "`]]>");
        result.add("\t\tWHERE `id` = #{id}");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genGetCount(String tableName) {
        List<String> result = new ArrayList<>();
        result.add("\t\t<![CDATA[SELECT COUNT(*) FROM `" + tableName + "`]]>");
        result.add("\t\t<!-- 加上“WHERE”前缀,去掉第一个“AND” -->");
        result.add("\t\t<trim prefix=\"WHERE\" prefixOverrides=\"AND \">");
        result.add("\t\t\t<!-- 自增id -->");
        result.add("\t\t\t<if test=\"null != id and id > 0\">");
        result.add("\t\t\t\tAND `id` = #{id}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 自增id列表 -->");
        result.add("\t\t\t<if test=\"null != listId and listId.size() > 0\">");
        result.add("\t\t\t\tAND `id` IN");
        result.add("\t\t\t\t<foreach collection=\"listId\" item=\"item\" open=\"(\" separator=\",\" close=\")\">");
        result.add("\t\t\t\t\t#{item}");
        result.add("\t\t\t\t</foreach>");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据状态 -->");
        result.add("\t\t\t<if test=\"null != status and status > 0\">");
        result.add("\t\t\t\tAND `status` = #{status}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据状态列表 -->");
        result.add("\t\t\t<if test=\"null != listStatus and listStatus.size() > 0\">");
        result.add("\t\t\t\tAND `status` IN");
        result.add("\t\t\t\t<foreach collection=\"listStatus\" item=\"item\" open=\"(\" separator=\",\" close=\")\">");
        result.add("\t\t\t\t\t#{item}");
        result.add("\t\t\t\t</foreach>");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 关键字模糊搜索 -->");
        result.add("\t\t\t<!-- <if test=\"null != keywords and '' != keywords.trim()\">");
        result.add("\t\t\t\tAND (`user_name` LIKE #{keywords} OR `nick_name` LIKE #{keywords})");
        result.add("\t\t\t</if> -->");
        result.add("\t\t\t<!-- 数据创建时间-起始 -->");
        result.add("\t\t\t<if test=\"null != createTimeStart and createTimeStart > 0\">");
        result.add("\t\t\t\tAND `create_time` >= #{createTimeStart}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据创建时间-截止 -->");
        result.add("\t\t\t<if test=\"null != createTimeEnd and createTimeEnd > 0\">");
        result.add("\t\t\t\tAND `create_time` &lt;= #{createTimeEnd}");
        result.add("\t\t\t</if>");
        result.add("\t\t</trim>");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    private static String genGetList(String tableName, Map<String, String> mapResultMap, Map<String, String> mapResultMapDesc) {
        List<String> result = new ArrayList<>();
        result.add("\t\t<![CDATA[SELECT");
        List<String> listColumn = new ArrayList<>();
        for (Map.Entry<String, String> entry : mapResultMap.entrySet()) {
            String name = entry.getKey();
            listColumn.add("\t\t`" + name + "`");
        }
        result.add(StringUtil.join(listColumn, ",\r\n"));
        result.add("\t\tFROM `" + tableName + "`]]>");
        result.add("\t\t<!-- 加上“WHERE”前缀,去掉第一个“AND” -->");
        result.add("\t\t<trim prefix=\"WHERE\" prefixOverrides=\"AND \">");
        result.add("\t\t\t<!-- 自增id -->");
        result.add("\t\t\t<if test=\"null != id and id > 0\">");
        result.add("\t\t\t\tAND `id` = #{id}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 自增id列表 -->");
        result.add("\t\t\t<if test=\"null != listId and listId.size() > 0\">");
        result.add("\t\t\t\tAND `id` IN");
        result.add("\t\t\t\t<foreach collection=\"listId\" item=\"item\" open=\"(\" separator=\",\" close=\")\">");
        result.add("\t\t\t\t\t#{item}");
        result.add("\t\t\t\t</foreach>");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据状态 -->");
        result.add("\t\t\t<if test=\"null != status and status > 0\">");
        result.add("\t\t\t\tAND `status` = #{status}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据状态列表 -->");
        result.add("\t\t\t<if test=\"null != listStatus and listStatus.size() > 0\">");
        result.add("\t\t\t\tAND `status` IN");
        result.add("\t\t\t\t<foreach collection=\"listStatus\" item=\"item\" open=\"(\" separator=\",\" close=\")\">");
        result.add("\t\t\t\t\t#{item}");
        result.add("\t\t\t\t</foreach>");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 关键字模糊搜索 -->");
        result.add("\t\t\t<!-- <if test=\"null != keywords and '' != keywords.trim()\">");
        result.add("\t\t\t\tAND (`user_name` LIKE #{keywords} OR `nick_name` LIKE #{keywords})");
        result.add("\t\t\t</if> -->");
        result.add("\t\t\t<!-- 数据创建时间-起始 -->");
        result.add("\t\t\t<if test=\"null != createTimeStart and createTimeStart > 0\">");
        result.add("\t\t\t\tAND `create_time` >= #{createTimeStart}");
        result.add("\t\t\t</if>");
        result.add("\t\t\t<!-- 数据创建时间-截止 -->");
        result.add("\t\t\t<if test=\"null != createTimeEnd and createTimeEnd > 0\">");
        result.add("\t\t\t\tAND `create_time` &lt;= #{createTimeEnd}");
        result.add("\t\t\t</if>");
        result.add("\t\t</trim>");
        result.add("\t\t<choose>");
        result.add("\t\t\t<when test=\"null!=orderBy and orderBy.trim()!=''\">");
        result.add("\t\t\t\tORDER BY ${orderBy}");
        result.add("\t\t\t</when>");
        result.add("\t\t\t<otherwise>");
        result.add("\t\t\t\tORDER BY id DESC");
        result.add("\t\t\t</otherwise>");
        result.add("\t\t</choose>");
        result.add("\t\t<if test=\"null!=pageSize and pageSize>0 and null!=lastRowNo and lastRowNo>=0\">");
        result.add("\t\t\tLIMIT ${lastRowNo}, ${pageSize}");
        result.add("\t\t</if>");
        return StringUtil.join(result, ConstantFactory.STR_NEWLINE);
    }
    //#endregion