feat(后台管理): 金刚位管理

添加基础代码
master
wayn 4 years ago
parent d121ee0706
commit 0746b2ff83

@ -57,6 +57,12 @@ public class ColumnController extends BaseController {
return R.success().add("page", formatPage(columnIPage, columnVOS));
}
@GetMapping("/listAll")
public R listAll() {
List<Column> columnList = iColumnService.list();
return R.success().add("data", columnList);
}
@PostMapping
public R addBanner(@Validated @RequestBody Column column) {
column.setCreateTime(new Date());

@ -1,10 +1,50 @@
package com.wayn.admin.api.controller.shop;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.common.base.controller.BaseController;
import com.wayn.common.core.domain.shop.Diamond;
import com.wayn.common.core.service.shop.IDiamondService;
import com.wayn.common.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("shop/diamond")
public class DiamondController {
public class DiamondController extends BaseController {
@Autowired
private IDiamondService iDiamondService;
@GetMapping("/list")
public R list(Diamond diamond) {
Page<Diamond> page = getPage();
IPage<Diamond> diamondIPage = iDiamondService.listPage(page, diamond);
return R.success().add("page", diamondIPage);
}
@PostMapping
public R addDiamond(@Validated @RequestBody Diamond diamond) {
diamond.setCreateTime(new Date());
return R.result(iDiamondService.save(diamond));
}
@PutMapping
public R updateDiamond(@Validated @RequestBody Diamond diamond) {
diamond.setUpdateTime(new Date());
return R.result(iDiamondService.updateById(diamond));
}
@GetMapping("{diamondId}")
public R getDiamond(@PathVariable Long diamondId) {
return R.success().add("data", iDiamondService.getById(diamondId));
}
@DeleteMapping("{diamondIds}")
public R deleteDiamond(@PathVariable List<Long> diamondIds) {
return R.result(iDiamondService.removeByIds(diamondIds));
}
}

@ -53,14 +53,14 @@ public class Diamond extends ShopBaseEntity implements Serializable {
private String valueUrl;
/**
*
*
*/
private String icon;
private String iconUrl;
/**
* banner
* banner
*/
private String image;
private String picUrl;
/**
* 01

@ -1,6 +1,8 @@
package com.wayn.common.core.mapper.shop;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wayn.common.core.domain.shop.Diamond;
/**
@ -13,4 +15,5 @@ import com.wayn.common.core.domain.shop.Diamond;
*/
public interface DiamondMapper extends BaseMapper<Diamond> {
IPage<Diamond> selectDiamondListPage(Page<Diamond> page, Diamond diamond);
}

@ -1,5 +1,7 @@
package com.wayn.common.core.service.shop;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wayn.common.core.domain.shop.Diamond;
@ -13,4 +15,5 @@ import com.wayn.common.core.domain.shop.Diamond;
*/
public interface IDiamondService extends IService<Diamond> {
IPage<Diamond> listPage(Page<Diamond> page, Diamond diamond);
}

@ -1,9 +1,12 @@
package com.wayn.common.core.service.shop.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wayn.common.core.domain.shop.Diamond;
import com.wayn.common.core.mapper.shop.DiamondMapper;
import com.wayn.common.core.service.shop.IDiamondService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@ -17,4 +20,11 @@ import org.springframework.stereotype.Service;
@Service
public class DiamondServiceImpl extends ServiceImpl<DiamondMapper, Diamond> implements IDiamondService {
@Autowired
private DiamondMapper diamondMapper;
@Override
public IPage<Diamond> listPage(Page<Diamond> page, Diamond diamond) {
return diamondMapper.selectDiamondListPage(page, diamond);
}
}

@ -6,12 +6,12 @@
<resultMap id="BaseResultMap" type="com.wayn.common.core.domain.shop.Diamond">
<result column="id" property="id" />
<result column="name" property="name" />
<result column="sort" property="sort" />
<result column="sort" property="sort" />
<result column="jump_type" property="jumpType" />
<result column="value_id" property="valueId" />
<result column="value_url" property="valueUrl" />
<result column="icon" property="icon" />
<result column="image" property="image" />
<result column="icon_url" property="iconUrl" />
<result column="pic_url" property="picUrl" />
<result column="status" property="status" />
<result column="del_flag" property="delFlag" />
<result column="create_time" property="createTime" />
@ -19,9 +19,24 @@
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
<sql id="selectDiamondVo">
select id,
name, sort, jump_type, value_id, value_url, icon, image, status, del_flag, create_time, update_time from diamond
name, sort, jump_type, value_id, value_url, icon_url, pic_url, status, del_flag, create_time, update_time from shop_diamond
</sql>
<select id="selectDiamondListPage" resultMap="BaseResultMap">
<include refid="selectDiamondVo"/>
<where>
del_flag = 0
<if test="diamond.name != null and diamond.name != ''">
AND name like concat('%', #{diamond.name}, '%')
</if>
<if test="diamond.startTime != null and diamond.startTime != ''">
and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ >= ]]> DATE_FORMAT(#{diamond.startTime},'%Y-%m-%d')
</if>
<if test="diamond.endTime != null and diamond.endTime != ''">
and DATE_FORMAT(create_time,'%Y-%m-%d') <![CDATA[ <= ]]> DATE_FORMAT(#{diamond.endTime},'%Y-%m-%d')
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save