import org.apache.ibatis.annotations.Param;
public interface PermissionTemplateCharacteristicMapper {
+
+ PermissionTemplateCharacteristicDto selectById(@Param("id") long id);
+
List<PermissionTemplateCharacteristicDto> selectByTemplateIds(@Param("templateIds") List<Long> templateId);
PermissionTemplateCharacteristicDto selectByPermissionAndTemplateId(@Param("permission") String permission, @Param("templateId") long templateId);
ptc.updated_at as updatedAt
</sql>
+ <select id="selectById" parameterType="long" resultType="PermissionTemplateCharacteristic">
+ select
+ <include refid="columns" />
+ from perm_tpl_characteristics ptc
+ where ptc.id=#{id,jdbcType=BIGINT}
+ </select>
+
<select id="selectByTemplateIds" parameterType="long" resultType="PermissionTemplateCharacteristic">
select
<include refid="columns" />
.setCreatedAt(123_456_789L)
.setUpdatedAt(2_000_000_000L));
- PermissionTemplateCharacteristicDto result = selectById(expectedResult.getId());
+ PermissionTemplateCharacteristicDto result = dbSession.getMapper(PermissionTemplateCharacteristicMapper.class).selectById(expectedResult.getId());
assertThat(result.getId()).isNotNull();
assertThat(result).isEqualToComparingFieldByField(expectedResult);
}
assertThat(underTest.selectByTemplateIds(dbSession, asList(1L))).hasSize(0);
assertThat(underTest.selectByTemplateIds(dbSession, asList(1L, 2L))).hasSize(1);
}
-
- private PermissionTemplateCharacteristicDto selectById(long id) {
- return db.getDbClient().permissionTemplateCharacteristicDao().selectByTemplateIds(dbSession, asList(id)).get(0);
- }
}