协议分页查询
This commit is contained in:
parent
e9807ad8a8
commit
7e12da4b6d
|
|
@ -3,9 +3,14 @@ package com.bonus.base.controller;
|
|||
import com.bonus.base.domain.BmAgreement;
|
||||
import com.bonus.base.service.BmAgreementService;
|
||||
import com.bonus.base.utils.ResultBean;
|
||||
import com.bonus.common.core.constant.HttpStatus;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 协议管理(bm_agreement)表控制层
|
||||
*
|
||||
|
|
@ -13,7 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/bm_agreement")
|
||||
public class BmAgreementController {
|
||||
public class BmAgreementController extends BaseController {
|
||||
|
||||
/**
|
||||
* 服务对象
|
||||
|
|
@ -21,6 +26,18 @@ public class BmAgreementController {
|
|||
@Autowired
|
||||
private BmAgreementService bmAgreementService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmAgreement bmAgreement) {
|
||||
startPage();
|
||||
List<BmAgreement> list = this.bmAgreementService.selectAll();
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
|
|
@ -41,7 +58,7 @@ public class BmAgreementController {
|
|||
@PostMapping(value = "/add")
|
||||
public ResultBean<Boolean> add(BmAgreement bmAgreement) {
|
||||
int result = this.bmAgreementService.insertSelective(bmAgreement);
|
||||
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败");
|
||||
return result > 0 ? ResultBean.success(true) : ResultBean.error("删除失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.bonus.base.mapper;
|
|||
import com.bonus.base.domain.BmAgreement;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@PackagePath: com.bonus.base.mapper
|
||||
*@author : 阮世耀
|
||||
|
|
@ -44,6 +46,8 @@ public interface BmAgreementMapper {
|
|||
*/
|
||||
BmAgreement selectByPrimaryKey(Integer id);
|
||||
|
||||
List<BmAgreement> selectAll();
|
||||
|
||||
/**
|
||||
* update record selective
|
||||
* @param record the updated record
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import com.bonus.base.domain.BmAgreement;
|
|||
import com.bonus.base.mapper.BmAgreementMapper;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @PackagePath: com.bonus.base
|
||||
|
|
@ -24,6 +25,8 @@ public class BmAgreementService{
|
|||
@Resource
|
||||
private BmAgreementMapper bmAgreementMapper;
|
||||
|
||||
public List<BmAgreement> selectAll() {return bmAgreementMapper.selectAll();}
|
||||
|
||||
public int deleteByPrimaryKey(Integer id) {
|
||||
return bmAgreementMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ import lombok.RequiredArgsConstructor;
|
|||
public final class ResultBean<T> {
|
||||
|
||||
private final int code;
|
||||
|
||||
private final String message;
|
||||
|
||||
private final T data;
|
||||
|
||||
/**
|
||||
|
|
@ -37,7 +39,7 @@ public final class ResultBean<T> {
|
|||
* @return 构建的ResultBean实例
|
||||
*/
|
||||
public static <T> ResultBean<T> error(String message) {
|
||||
return new ResultBean<>(500, message, null);
|
||||
return new ResultBean<>(HttpStatus.ERROR, message, null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@
|
|||
from bm_agreement
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_agreement
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from bm_agreement
|
||||
|
|
@ -484,4 +491,5 @@
|
|||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue