协议分页查询
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.domain.BmAgreement;
|
||||||
import com.bonus.base.service.BmAgreementService;
|
import com.bonus.base.service.BmAgreementService;
|
||||||
import com.bonus.base.utils.ResultBean;
|
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.web.bind.annotation.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 协议管理(bm_agreement)表控制层
|
* 协议管理(bm_agreement)表控制层
|
||||||
*
|
*
|
||||||
|
|
@ -13,7 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/bm_agreement")
|
@RequestMapping("/bm_agreement")
|
||||||
public class BmAgreementController {
|
public class BmAgreementController extends BaseController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务对象
|
* 服务对象
|
||||||
|
|
@ -21,6 +26,18 @@ public class BmAgreementController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BmAgreementService bmAgreementService;
|
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")
|
@PostMapping(value = "/add")
|
||||||
public ResultBean<Boolean> add(BmAgreement bmAgreement) {
|
public ResultBean<Boolean> add(BmAgreement bmAgreement) {
|
||||||
int result = this.bmAgreementService.insertSelective(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 com.bonus.base.domain.BmAgreement;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@PackagePath: com.bonus.base.mapper
|
*@PackagePath: com.bonus.base.mapper
|
||||||
*@author : 阮世耀
|
*@author : 阮世耀
|
||||||
|
|
@ -44,6 +46,8 @@ public interface BmAgreementMapper {
|
||||||
*/
|
*/
|
||||||
BmAgreement selectByPrimaryKey(Integer id);
|
BmAgreement selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
List<BmAgreement> selectAll();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* update record selective
|
* update record selective
|
||||||
* @param record the updated record
|
* @param record the updated record
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.bonus.base.domain.BmAgreement;
|
||||||
import com.bonus.base.mapper.BmAgreementMapper;
|
import com.bonus.base.mapper.BmAgreementMapper;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @PackagePath: com.bonus.base
|
* @PackagePath: com.bonus.base
|
||||||
|
|
@ -24,6 +25,8 @@ public class BmAgreementService{
|
||||||
@Resource
|
@Resource
|
||||||
private BmAgreementMapper bmAgreementMapper;
|
private BmAgreementMapper bmAgreementMapper;
|
||||||
|
|
||||||
|
public List<BmAgreement> selectAll() {return bmAgreementMapper.selectAll();}
|
||||||
|
|
||||||
public int deleteByPrimaryKey(Integer id) {
|
public int deleteByPrimaryKey(Integer id) {
|
||||||
return bmAgreementMapper.deleteByPrimaryKey(id);
|
return bmAgreementMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,9 @@ import lombok.RequiredArgsConstructor;
|
||||||
public final class ResultBean<T> {
|
public final class ResultBean<T> {
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
||||||
private final String message;
|
private final String message;
|
||||||
|
|
||||||
private final T data;
|
private final T data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -37,7 +39,7 @@ public final class ResultBean<T> {
|
||||||
* @return 构建的ResultBean实例
|
* @return 构建的ResultBean实例
|
||||||
*/
|
*/
|
||||||
public static <T> ResultBean<T> error(String message) {
|
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
|
from bm_agreement
|
||||||
where id = #{id,jdbcType=INTEGER}
|
where id = #{id,jdbcType=INTEGER}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAll" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from bm_agreement
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
delete from bm_agreement
|
delete from bm_agreement
|
||||||
|
|
@ -484,4 +491,5 @@
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue