赞
踩
在easycode的设置里找到:
1、Template下的 mapper.xml.vm脚本
2、Global Config下的 mybatisSupport.vm脚本
然后将这两个脚本里的 $velocityHasNext 替换成 $foreach.hasNext,然后保存设置。之后新生成的mapper.xml里就不会出现没有逗号间隔的问题了。
##引入宏定义 $!{define.vm} ##使用宏定义设置回调(保存位置与文件后缀) #save("/entity", ".java") ##使用宏定义设置包后缀 #setPackageSuffix("entity") ##使用全局变量实现默认包导入 $!{autoImport.vm} import java.io.Serializable; ##使用宏定义实现类注释信息 #tableComment("实体类") public class $!{tableInfo.name} implements Serializable { private static final long serialVersionUID = $!tool.serial(); #foreach($column in $tableInfo.fullColumn) #if(${column.comment})/** * ${column.comment} */#end private $!{tool.getClsNameByFullName($column.type)} $!{column.name}; #end #foreach($column in $tableInfo.fullColumn) ##使用宏定义实现get,set方法 #getSetMethod($column) #end }
##定义初始变量 #set($tableName = $tool.append($tableInfo.name, "Dao")) ##设置回调 $!callback.setFileName($tool.append($tableName, ".java")) $!callback.setSavePath($tool.append($tableInfo.savePath, "/dao")) ##拿到主键 #if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0)) #end #if($tableInfo.savePackageName)package $!{tableInfo.savePackageName}.#{end}dao; import $!{tableInfo.savePackageName}.entity.$!{tableInfo.name}; import org.apache.ibatis.annotations.Param; import org.springframework.data.domain.Pageable; import java.util.List; /** * $!{tableInfo.comment}($!{tableInfo.name})表数据库访问层 * * @author $!author * @since $!time.currTime() */ public interface $!{tableName} { /** * 通过ID查询单条数据 * * @param $!pk.name 主键 * @return 实例对象 */ $!{tableInfo.name} queryById($!pk.shortType $!pk.name); /** * 查询指定行数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件 * @param pageable 分页对象 * @return 对象列表 */ List<$!{tableInfo.name}> queryAllByLimit($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name}), @Param("pageable") Pageable pageable); /** * 统计总行数 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 查询条件 * @return 总行数 */ long count($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 新增数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 影响行数 */ int insert($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 批量新增数据(MyBatis原生foreach方法) * * @param entities List<$!{tableInfo.name}> 实例对象列表 * @return 影响行数 */ int insertBatch(@Param("entities") List<$!{tableInfo.name}> entities); /** * 批量新增或按主键更新数据(MyBatis原生foreach方法) * * @param entities List<$!{tableInfo.name}> 实例对象列表 * @return 影响行数 * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 */ int insertOrUpdateBatch(@Param("entities") List<$!{tableInfo.name}> entities); /** * 修改数据 * * @param $!tool.firstLowerCase($!{tableInfo.name}) 实例对象 * @return 影响行数 */ int update($!{tableInfo.name} $!tool.firstLowerCase($!{tableInfo.name})); /** * 通过主键删除数据 * * @param $!pk.name 主键 * @return 影响行数 */ int deleteById($!pk.shortType $!pk.name); }
##引入mybatis支持 $!{mybatisSupport.vm} ##设置保存名称与保存位置 $!callback.setFileName($tool.append($!{tableInfo.name}, "Dao.xml")) $!callback.setSavePath($tool.append($modulePath, "/src/main/resources/mapper")) ##拿到主键 #if(!$tableInfo.pkColumn.isEmpty()) #set($pk = $tableInfo.pkColumn.get(0)) #end <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="$!{tableInfo.savePackageName}.dao.$!{tableInfo.name}Dao"> <resultMap type="$!{tableInfo.savePackageName}.entity.$!{tableInfo.name}" id="$!{tableInfo.name}Map"> #foreach($column in $tableInfo.fullColumn) <result property="$!column.name" column="$!column.obj.name" jdbcType="$!column.ext.jdbcType"/> #end </resultMap> <!--查询单个--> <select id="queryById" resultMap="$!{tableInfo.name}Map"> select #allSqlColumn() from $!tableInfo.obj.name where $!pk.obj.name = #{$!pk.name} </select> <!--查询指定行数据--> <select id="queryAllByLimit" resultMap="$!{tableInfo.name}Map"> select #allSqlColumn() from $!tableInfo.obj.name <where> #foreach($column in $tableInfo.fullColumn) <if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end"> and $!column.obj.name = #{$!column.name, $!column.ext.jdbcType} </if> #end </where> limit #{pageable.offset}, #{pageable.pageSize} </select> <!--统计总行数--> <select id="count" resultType="java.lang.Long"> select count(1) from $!tableInfo.obj.name <where> #foreach($column in $tableInfo.fullColumn) <if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end"> and $!column.obj.name = #{$!column.name, $!column.ext.jdbcType} </if> #end </where> </select> <!--新增所有列--> <insert id="insert" keyProperty="$!pk.name" useGeneratedKeys="true"> insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($foreach.hasNext), #end#end) values (#foreach($column in $tableInfo.otherColumn)#{$!{column.name}}#if($foreach.hasNext), #end#end) </insert> <insert id="insertBatch" keyProperty="$!pk.name" useGeneratedKeys="true"> insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($foreach.hasNext), #end#end) values <foreach collection="entities" item="entity" separator=","> ( #foreach($column in $tableInfo.otherColumn) <choose> <when test="entity.${column.name} != null"> #{entity.$!{column.name}}#if($foreach.hasNext), #end </when> <otherwise>NULL#if($foreach.hasNext), #end</otherwise> </choose> #end ) </foreach> </insert> <insert id="insertOrUpdateBatch" keyProperty="$!pk.name" useGeneratedKeys="true"> insert into $!{tableInfo.obj.name}(#foreach($column in $tableInfo.otherColumn)$!column.obj.name#if($foreach.hasNext), #end#end) values <foreach collection="entities" item="entity" separator=","> (#foreach($column in $tableInfo.otherColumn)#{entity.$!{column.name}}#if($foreach.hasNext), #end#end) </foreach> on duplicate key update #foreach($column in $tableInfo.otherColumn) $!column.obj.name = values($!column.obj.name)#if($foreach.hasNext), #end#end </insert> <!--通过主键修改数据--> <update id="update"> update $!{tableInfo.obj.name} <set> #foreach($column in $tableInfo.otherColumn) <if test="$!column.name != null#if($column.type.equals("java.lang.String")) and $!column.name != ''#end"> $!column.obj.name = #{$!column.name}, </if> #end </set> where $!pk.obj.name = #{$!pk.name} </update> <!--通过主键删除--> <delete id="deleteById"> delete from $!{tableInfo.obj.name} where $!pk.obj.name = #{$!pk.name} </delete> </mapper>
package com.sunxiansheng.subject.application.dto; import lombok.Data; import java.io.Serializable; /** * 题目标签表(SubjectLabel)实体类 */ @Data public class SubjectLabelDTO implements Serializable { private static final long serialVersionUID = 965293549798069262L; /** * 主键 */ private Long id; /** * 标签分类 */ private String labelName; /** * 排序 */ private Integer sortNum; /** * 分类id */ private String categoryId; }
package com.sunxiansheng.subject.application.convert; import com.sunxiansheng.subject.application.dto.SubjectLabelDTO; import com.sunxiansheng.subject.domain.entity.SubjectLabelBO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import java.util.List; /** * Description: DTO与BO转换 * @Author sun * @Create 2024/5/24 9:40 * @Version 1.0 */ @Mapper public interface SubjectLabelDTOConverter { SubjectLabelDTOConverter INSTANCE= Mappers.getMapper(SubjectLabelDTOConverter.class); // 将SubjectLabelDTO转换为SubjectLabelBO SubjectLabelBO convertDTOToSubjectLabel(SubjectLabelDTO subjectLabelDTO); // 将SubjectLabelBO转换为SubjectLabelDTO SubjectLabelDTO convertSubjectLabelToDto(SubjectLabelBO subjectLabelBO); // 将List<SubjectLabelDTO>转换为List<SubjectLabelBO> List<SubjectLabelBO> convertDTOToSubjectLabel(List<SubjectLabelDTO> subjectLabelDTOList); // 将List<SubjectLabelBO>转换为List<SubjectLabelDTO> List<SubjectLabelDTO> convertSubjectLabelToDto(List<SubjectLabelBO> subjectLabelBOList); }
package com.sunxiansheng.subject.domain.entity; import lombok.Data; import java.io.Serializable; /** * Description: * @Author sun * @Create 2024/5/25 17:10 * @Version 1.0 */ @Data public class SubjectLabelBO implements Serializable { private static final long serialVersionUID = 965293549798069262L; /** * 主键 */ private Long id; /** * 标签分类 */ private String labelName; /** * 排序 */ private Integer sortNum; /** * 分类id */ private String categoryId; }
package com.sunxiansheng.subject.domain.convert; import com.sunxiansheng.subject.domain.entity.SubjectLabelBO; import com.sunxiansheng.subject.infra.basic.entity.SubjectLabel; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import java.util.List; /** * Description: 题目标签转换器 * @Author sun * @Create 2024/5/24 9:18 * @Version 1.0 */ @Mapper // mapstruct的注解 public interface SubjectLabelConverter { SubjectLabelConverter INSTANCE = Mappers.getMapper(SubjectLabelConverter.class); // 将SubjectLabelBO转换为SubjectLabel SubjectLabel convertBoToSubjectLabel(SubjectLabelBO subjectLabelBO); // 将SubjectLabel转换为SubjectLabelBO SubjectLabelBO convertSubjectLabelToBo(SubjectLabel subjectLabel); // 将List<SubjectLabel>转换为List<SubjectLabelBO> List<SubjectLabelBO> convertSubjectLabelToBo(List<SubjectLabel> subjectLabelList); // 将List<SubjectLabelBO>转换为List<SubjectLabel> List<SubjectLabel> convertBoToSubjectLabel(List<SubjectLabelBO> subjectLabelBOList); }
package com.sunxiansheng.subject.domain.service; import com.sunxiansheng.subject.domain.entity.SubjectLabelBO; /** * Description: 题目标签领域服务 * @Author sun * @Create 2024/5/24 9:03 * @Version 1.0 */ public interface SubjectLabelDomainService { // 新增标签 Boolean add(SubjectLabelBO subjectLabelBO); }
package com.sunxiansheng.subject.application.controller; import com.alibaba.fastjson.JSON; import com.google.common.base.Preconditions; import com.sunxiansheng.subject.application.convert.SubjectCategoryDTOConverter; import com.sunxiansheng.subject.application.convert.SubjectLabelDTOConverter; import com.sunxiansheng.subject.application.dto.SubjectCategoryDTO; import com.sunxiansheng.subject.application.dto.SubjectLabelDTO; import com.sunxiansheng.subject.common.eneity.Result; import com.sunxiansheng.subject.domain.entity.SubjectCategoryBO; import com.sunxiansheng.subject.domain.entity.SubjectLabelBO; import com.sunxiansheng.subject.domain.service.SubjectLabelDomainService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; /** * Description: 题目标签controller * @Author sun * @Create 2024/5/25 16:54 * @Version 1.0 */ @RestController @RequestMapping("/subject/label") @Slf4j public class SubjectLabelController { @Resource private SubjectLabelDomainService subjectLabelDomainService; @PostMapping("/add") public Result<Boolean> add(@RequestBody SubjectLabelDTO subjectLabelDTO) { try { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelController add SubjectLabelDTO, subjectLabelDTO:{}", JSON.toJSONString(subjectLabelDTO)); } // 参数校验 Preconditions.checkArgument(!StringUtils.isBlank(subjectLabelDTO.getLabelName()), "标签名称不能为空"); // 转换DTO为BO SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDTOToSubjectLabel(subjectLabelDTO); // 调用领域服务 Boolean result = subjectLabelDomainService.add(subjectLabelBO); return Result.ok(result); } catch (Exception e) { log.error("SubjectLabelController add error:{}", e.getMessage(), e); return Result.fail("新增标签失败"); } } }
package com.sunxiansheng.subject.domain.service.impl; import com.alibaba.fastjson.JSON; import com.sunxiansheng.subject.common.enums.IsDeleteFlagEnum; import com.sunxiansheng.subject.domain.convert.SubjectLabelConverter; import com.sunxiansheng.subject.domain.entity.SubjectLabelBO; import com.sunxiansheng.subject.domain.service.SubjectLabelDomainService; import com.sunxiansheng.subject.infra.basic.entity.SubjectLabel; import com.sunxiansheng.subject.infra.basic.service.SubjectLabelService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; /** * Description: * @Author sun * @Create 2024/5/24 9:03 * @Version 1.0 */ @Service @Slf4j public class SubjectLabelDomainServiceImpl implements SubjectLabelDomainService { @Resource private SubjectLabelService subjectLabelService; @Override public Boolean add(SubjectLabelBO subjectLabelBO) { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelDomainServiceImpl add SubjectLabelBO, SubjectLabelBO:{}", JSON.toJSONString(subjectLabelBO)); } // 将BO转换为SubjectLabel SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE.convertBoToSubjectLabel(subjectLabelBO); // 设置逻辑删除 subjectLabel.setIsDeleted(IsDeleteFlagEnum.UN_DELETED.getCode()); // 插入数据 int insert = subjectLabelService.insert(subjectLabel); return insert > 0; } }
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int insert(SubjectLabel subjectLabel);
/**
* 新增数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int insert(SubjectLabel subjectLabel) {
return this.subjectLabelDao.insert(subjectLabel);
}
/** * 更新标签 * @param subjectLabelDTO * @return */ @PostMapping("/update") public Result<Boolean> update(@RequestBody SubjectLabelDTO subjectLabelDTO) { try { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelController update SubjectLabelDTO, subjectLabelDTO:{}", JSON.toJSONString(subjectLabelDTO)); } // 参数校验 Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空"); // 转换DTO为BO SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDTOToSubjectLabel(subjectLabelDTO); // 调用领域服务 Boolean result = subjectLabelDomainService.update(subjectLabelBO); return Result.ok(result); } catch (Exception e) { log.error("SubjectLabelController update error:{}", e.getMessage(), e); return Result.fail("更新标签失败"); } }
/**
* 更新标签
* @param subjectLabelBO
* @return
*/
Boolean update(SubjectLabelBO subjectLabelBO);
@Override
public Boolean update(SubjectLabelBO subjectLabelBO) {
// 打印日志
if (log.isInfoEnabled()) {
log.info("SubjectLabelDomainServiceImpl update SubjectLabelBO, SubjectLabelBO:{}", JSON.toJSONString(subjectLabelBO));
}
// 将BO转换为SubjectLabel
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE.convertBoToSubjectLabel(subjectLabelBO);
// 更新数据
int update = subjectLabelService.update(subjectLabel);
return update > 0;
}
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
int update(SubjectLabel subjectLabel);
/**
* 修改数据
*
* @param subjectLabel 实例对象
* @return 实例对象
*/
@Override
public int update(SubjectLabel subjectLabel) {
return this.subjectLabelDao.update(subjectLabel);
}
/** * 删除标签 * @param subjectLabelDTO * @return */ @PostMapping("/delete") public Result<Boolean> delete(@RequestBody SubjectLabelDTO subjectLabelDTO) { try { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelController delete SubjectLabelDTO, subjectLabelDTO:{}", JSON.toJSONString(subjectLabelDTO)); } // 参数校验 Preconditions.checkNotNull(subjectLabelDTO.getId(), "标签id不能为空"); // 转换DTO为BO SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDTOToSubjectLabel(subjectLabelDTO); // 调用领域服务 Boolean result = subjectLabelDomainService.delete(subjectLabelBO); return Result.ok(result); } catch (Exception e) { log.error("SubjectLabelController delete error:{}", e.getMessage(), e); return Result.fail("删除标签失败"); } }
/**
* 删除标签
* @param subjectLabelBO
* @return
*/
Boolean delete(SubjectLabelBO subjectLabelBO);
@Override
public Boolean delete(SubjectLabelBO subjectLabelBO) {
// 打印日志
if (log.isInfoEnabled()) {
log.info("SubjectLabelDomainServiceImpl delete SubjectLabelBO, SubjectLabelBO:{}", JSON.toJSONString(subjectLabelBO));
}
// 将BO转换为SubjectLabel
SubjectLabel subjectLabel = SubjectLabelConverter.INSTANCE.convertBoToSubjectLabel(subjectLabelBO);
// 设置逻辑删除
subjectLabel.setIsDeleted(IsDeleteFlagEnum.DELETED.getCode());
// 更新数据
int delete = subjectLabelService.update(subjectLabel);
return delete > 0;
}
/** * 查询分类下的标签 * @param subjectLabelDTO * @return */ @PostMapping("/queryLabelByCategoryId") public Result<List<SubjectLabelDTO>> queryLabelByCategoryId(@RequestBody SubjectLabelDTO subjectLabelDTO) { try { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelController queryLabelByCategoryId SubjectLabelDTO, subjectLabelDTO:{}", JSON.toJSONString(subjectLabelDTO)); } // 参数校验 Preconditions.checkNotNull(subjectLabelDTO.getCategoryId(), "分类id不能为空"); // 转换DTO为BO SubjectLabelBO subjectLabelBO = SubjectLabelDTOConverter.INSTANCE.convertDTOToSubjectLabel(subjectLabelDTO); // 调用领域服务 List<SubjectLabelBO> subjectLabelBOList = subjectLabelDomainService.queryLabelByCategoryId(subjectLabelBO); // 将BO转换为DTO List<SubjectLabelDTO> subjectLabelDTOList = SubjectLabelDTOConverter.INSTANCE.convertSubjectLabelToDto(subjectLabelBOList); return Result.ok(subjectLabelDTOList); } catch (Exception e) { log.error("SubjectLabelController queryLabelByCategoryId error:{}", e.getMessage(), e); return Result.fail("查询分类下的标签失败"); } }
/**
* 查询分类下标签
* @param subjectLabelBO
* @return
*/
List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO);
@Override public List<SubjectLabelBO> queryLabelByCategoryId(SubjectLabelBO subjectLabelBO) { // 打印日志 if (log.isInfoEnabled()) { log.info("SubjectLabelDomainServiceImpl queryLabelByCategoryId SubjectLabelBO, SubjectLabelBO:{}", JSON.toJSONString(subjectLabelBO)); } // 获取分类id String categoryId = subjectLabelBO.getCategoryId(); SubjectMapping subjectMapping = new SubjectMapping(); // 设置分类id subjectMapping.setCategoryId(Long.parseLong(categoryId)); // 设置逻辑删除 subjectMapping.setIsDeleted(IsDeleteFlagEnum.UN_DELETED.getCode()); // 查询所有分类id对应的标签id List<SubjectMapping> mappingList = subjectMappingService.queryLabelId(subjectMapping); // 判断是否为空 if (CollectionUtils.isEmpty(mappingList)) { return Collections.emptyList(); } // 获取标签id List<Long> labelIds = mappingList.stream().map(SubjectMapping::getLabelId).collect(Collectors.toList()); // 对标签表进行批量查询 List<SubjectLabel> subjectLabels = subjectLabelService.batchQueryById(labelIds); // 将SubjectLabel转换为BO List<SubjectLabelBO> collect = subjectLabels.stream().map( subjectLabel -> { // 创建一个SubjectLabelBO对象,用于存储转换后的数据 SubjectLabelBO subjectLabelBO1 = new SubjectLabelBO(); subjectLabelBO1.setId(subjectLabel.getId()); subjectLabelBO1.setLabelName(subjectLabel.getLabelName()); subjectLabelBO1.setSortNum(subjectLabel.getSortNum()); subjectLabelBO1.setCategoryId(subjectLabel.getCategoryId().toString()); return subjectLabelBO1; } ).collect(Collectors.toList()); return collect; }
/**
* 查询标签id
* @param subjectMapping
* @return
*/
List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping);
/**
* 批量查询标签
* @param labelIds
* @return
*/
List<SubjectLabel> batchQueryById(List<Long> labelIds);
/**
* 查询标签id
* @param subjectMapping
* @return
*/
@Override
public List<SubjectMapping> queryLabelId(SubjectMapping subjectMapping) {
return this.subjectMappingDao.queryDistinctLabelId(subjectMapping);
}
/**
* 批量查询标签
* @param labelIdList
* @return
*/
@Override
public List<SubjectLabel> batchQueryById(List<Long> labelIdList) {
if (!CollectionUtils.isEmpty(labelIdList)) {
return Collections.emptyList();
}
return subjectLabelDao.batchQueryById(labelIdList);
}
/**
* 查询标签id
* @param subjectMapping
* @return
*/
List<SubjectMapping> queryDistinctLabelId(SubjectMapping subjectMapping);
/**
* 批量查询标签
* @param labelIdList
* @return
*/
List<SubjectLabel> batchQueryById(List<Long> labelIdList);
<!--根据分类的id查询不重复的所有标签id--> <select id="queryDistinctLabelId" resultMap="SubjectMappingMap"> select distinct label_id from subject_mapping <where> <if test="id != null"> and id = #{id, INTEGER} </if> <if test="subjectId != null"> and subject_id = #{subjectId, INTEGER} </if> <if test="categoryId != null"> and category_id = #{categoryId, INTEGER} </if> <if test="labelId != null"> and label_id = #{labelId, INTEGER} </if> <if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy, VARCHAR} </if> <if test="createdTime != null"> and created_time = #{createdTime, TIMESTAMP} </if> <if test="updateBy != null and updateBy != ''"> and update_by = #{updateBy, VARCHAR} </if> <if test="updateTime != null"> and update_time = #{updateTime, TIMESTAMP} </if> <if test="isDeleted != null"> and is_deleted = #{isDeleted, INTEGER} </if> </where> </select>
<!--根据标签id批量查询所有记录-->
<select id="batchQueryById" resultMap="SubjectLabelMap">
select id, label_name, sort_num, category_id, created_by, created_time, update_by, update_time, is_deleted
from subject_label
where id in
<foreach collection="labelIdList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。