国家区域
This commit is contained in:
@@ -0,0 +1,70 @@
|
|||||||
|
package com.peanut.modules.book.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.modules.book.entity.BaseAreaEntity;
|
||||||
|
import com.peanut.modules.book.service.BaseAreaService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/book/baseArea")
|
||||||
|
public class BaseAreaController {
|
||||||
|
@Autowired
|
||||||
|
private BaseAreaService baseAreaService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加区域
|
||||||
|
* @param baseArea
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/addBaseArea")
|
||||||
|
public R addBaseArea(@RequestBody BaseAreaEntity baseArea){
|
||||||
|
baseAreaService.save(baseArea);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除区域
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/delBaseArea")
|
||||||
|
public R delBaseArea(@RequestBody Map<String,Object> map){
|
||||||
|
Integer areaId = Integer.valueOf(map.get("areaId").toString());
|
||||||
|
baseAreaService.removeById(areaId);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑区域信息
|
||||||
|
* @param baseArea
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/editBaseArea")
|
||||||
|
public R editBaseArea(@RequestBody BaseAreaEntity baseArea){
|
||||||
|
baseAreaService.updateById(baseArea);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取区域列表
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getBaseAreas")
|
||||||
|
public R getBaseAreas(@RequestBody Map<String,Object> map){
|
||||||
|
Integer limit = Integer.valueOf(map.get("limit").toString());
|
||||||
|
Integer page = Integer.valueOf(map.get("page").toString());
|
||||||
|
|
||||||
|
Page baseAreas = baseAreaService.getBaseAreas(limit, page);
|
||||||
|
return R.ok().put("page",baseAreas);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
10
src/main/java/com/peanut/modules/book/dao/BaseAreaDao.java
Normal file
10
src/main/java/com/peanut/modules/book/dao/BaseAreaDao.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.peanut.modules.book.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.book.entity.BaseAreaEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BaseAreaDao extends MPJBaseMapper<BaseAreaEntity> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.peanut.modules.book.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("/base_area")
|
||||||
|
public class BaseAreaEntity implements Serializable {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer areaId;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private int delFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.peanut.modules.book.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.book.entity.BaseAreaEntity;
|
||||||
|
|
||||||
|
|
||||||
|
public interface BaseAreaService extends IService<BaseAreaEntity> {
|
||||||
|
|
||||||
|
Page getBaseAreas(Integer limit, Integer page);
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.peanut.modules.book.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.book.dao.BaseAreaDao;
|
||||||
|
import com.peanut.modules.book.entity.BaseAreaEntity;
|
||||||
|
import com.peanut.modules.book.service.BaseAreaService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service("baseAreaService")
|
||||||
|
public class BaseAreaServiceImpl extends ServiceImpl<BaseAreaDao, BaseAreaEntity> implements BaseAreaService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page getBaseAreas(Integer limit, Integer page) {
|
||||||
|
LambdaQueryWrapper<BaseAreaEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(BaseAreaEntity::getDelFlag,0);
|
||||||
|
Page<BaseAreaEntity> baseAreaEntityPage = getBaseMapper().selectPage(new Page<BaseAreaEntity>(page, limit), wrapper);
|
||||||
|
return baseAreaEntityPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<?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="com.peanut.modules.book.dao.CouponProductRelationDao">
|
|
||||||
|
|
||||||
<!-- 可根据自己的需求,是否要使用 -->
|
|
||||||
<resultMap type="com.peanut.modules.book.entity.CouponProductRelationEntity" id="couponProductRelationMap">
|
|
||||||
<result property="id" column="id"/>
|
|
||||||
<result property="couponId" column="coupon_id"/>
|
|
||||||
<result property="productId" column="product_id"/>
|
|
||||||
<result property="productName" column="product_name"/>
|
|
||||||
<result property="productSn" column="product_sn"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
Reference in New Issue
Block a user