Commit a95b79eb authored by taabe's avatar taabe

添加DemoMapper.xml

parent 84848d16
package org.amos.boot.module.jcs.api.mapper; package org.amos.boot.module.jcs.api.mapper;
import org.amos.boot.module.jcs.api.entity.CbDemo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.amos.boot.module.jcs.api.entity.CbDemo;
/** /**
* @Description: 示例代码 * @Description: 示例代码
* @Author: amos-boot-biz * @Author: amos-boot-biz
...@@ -10,5 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -10,5 +9,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @Version: V1.0 * @Version: V1.0
*/ */
public interface DemoMapper extends BaseMapper<CbDemo>{ public interface DemoMapper extends BaseMapper<CbDemo>{
CbDemo selectOneBySeqNbr(Long seqNbr);
} }
...@@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -12,5 +12,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @since 2021-05-27 * @since 2021-05-27
*/ */
public interface IDemoService extends IService<CbDemo> { public interface IDemoService extends IService<CbDemo> {
public CbDemo selectOneBySeqNbr(Long seqNbr);
} }
<?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="org.amos.boot.module.jcs.api.mapper.DemoMapper">
<select id="selectOneBySeqNbr" resultType="org.amos.boot.module.jcs.api.entity.CbDemo">
select * from tb_demo where sequence_nbr = #{seqNbr};
</select>
</mapper>
...@@ -8,6 +8,7 @@ import org.amos.boot.module.jcs.api.entity.CbDemo; ...@@ -8,6 +8,7 @@ import org.amos.boot.module.jcs.api.entity.CbDemo;
import org.amos.boot.module.jcs.api.service.IDemoService; import org.amos.boot.module.jcs.api.service.IDemoService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
...@@ -36,4 +37,11 @@ public class DemoController extends BaseController { ...@@ -36,4 +37,11 @@ public class DemoController extends BaseController {
List<CbDemo> lists = demoService.list(); List<CbDemo> lists = demoService.list();
return CommonResponseUtil.success(lists); return CommonResponseUtil.success(lists);
} }
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/demo/{seqNbr}")
public ResponseModel findOneBySeqNbr(@PathVariable("seqNbr") Long seqNbr) {
CbDemo demo = demoService.selectOneBySeqNbr(seqNbr);
return CommonResponseUtil.success(demo);
}
} }
...@@ -20,4 +20,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -20,4 +20,9 @@ import lombok.extern.slf4j.Slf4j;
@Slf4j @Slf4j
public class DemoServiceImpl extends ServiceImpl<DemoMapper, CbDemo> implements IDemoService { public class DemoServiceImpl extends ServiceImpl<DemoMapper, CbDemo> implements IDemoService {
@Override
public CbDemo selectOneBySeqNbr(Long seqNbr) {
CbDemo demo = this.getBaseMapper().selectOneBySeqNbr(seqNbr);
return demo;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment