Commit 65c7eb79 by rongkailun

【新增】提供商管理新增修改删除列表

parent 606b59a2
package io.office.modules.manage.controller; package io.office.modules.manage.controller;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.ProductEntity;
import io.office.modules.sys.controller.AbstractController;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.PartnersEntity; import io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.manage.service.PartnersService; import io.office.modules.manage.service.PartnersService;
...@@ -27,7 +29,8 @@ import io.office.common.utils.R; ...@@ -27,7 +29,8 @@ import io.office.common.utils.R;
*/ */
@RestController @RestController
@RequestMapping("/partners") @RequestMapping("/partners")
public class PartnersController { @Slf4j
public class PartnersController extends AbstractController {
@Autowired @Autowired
private PartnersService partnersService; private PartnersService partnersService;
...@@ -37,9 +40,11 @@ public class PartnersController { ...@@ -37,9 +40,11 @@ public class PartnersController {
@RequestMapping("/list") @RequestMapping("/list")
// @RequiresPermissions("manage:partners:list") // @RequiresPermissions("manage:partners:list")
public R list(@RequestParam Map<String, Object> params){ public R list(@RequestParam Map<String, Object> params){
PageUtils page = partnersService.queryPage(params); Page<PartnersEntity> page = this.partnersService.selectPartnersList(params,
new Page(Integer.valueOf(params.get("page").toString()),
return R.ok().put("page", page); Integer.valueOf(params.get("limit").toString())));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("page", pageUtils);
} }
...@@ -57,34 +62,56 @@ public class PartnersController { ...@@ -57,34 +62,56 @@ public class PartnersController {
/** /**
* 保存 * 保存
*/ */
@RequestMapping("/save") @PostMapping("/save")
// @RequiresPermissions("manage:partners:save") // @RequiresPermissions("manage:partners:save")
public R save(@RequestBody PartnersEntity partners){ public R save(@RequestBody PartnersEntity partners){
partners.setEditor(getUser().getUsername());
partners.setLasteditor(getUser().getUsername());
partnersService.save(partners); partnersService.save(partners);
return R.ok("新增成功!");
return R.ok();
} }
/** /**
* 修改 * 修改
*/ */
@RequestMapping("/update") @PostMapping("/update")
// @RequiresPermissions("manage:partners:update") // @RequiresPermissions("manage:partners:update")
public R update(@RequestBody PartnersEntity partners){ public R update(@RequestBody PartnersEntity partners){
partners.setEditor(getUser().getUsername());
partners.setLasteditor(getUser().getUsername());
partners.setUpdatedate(new Date());
partnersService.updateById(partners); partnersService.updateById(partners);
return R.ok("修改成功!");
return R.ok();
} }
/** /**
* 删除 * 删除
*/ */
@RequestMapping("/delete") @PostMapping("/delete")
// @RequiresPermissions("manage:partners:delete") // @RequiresPermissions("manage:partners:delete")
public R delete(@RequestBody Integer[] ids){ public R delete(@RequestBody List<Long> ids){
partnersService.removeByIds(Arrays.asList(ids)); try {
R r = this.partnersService.deletePartners(ids, getUser());
return R.ok(); return r;
} catch (Exception e) {
log.error("delete error:", e);
return R.error(e.getMessage());
}
} }
/**
* 审核
*/
@PostMapping("/verifyPartners")
// @RequiresPermissions("manage:partners:delete")
public R verifyPartners(@RequestBody PartnersEntity partnersEntity){
try {
R r = this.partnersService.verifyPartners(partnersEntity, getUser());
return r;
} catch (Exception e) {
log.error("verifyPartners error:", e);
return R.error(e.getMessage());
}
}
} }
package io.office.modules.manage.dao; package io.office.modules.manage.dao;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.modules.manage.entity.PartnersEntity; import io.office.modules.manage.entity.PartnersEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/** /**
* 提供商管理 * 提供商管理
...@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,5 +18,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PartnersDao extends BaseMapper<PartnersEntity> { public interface PartnersDao extends BaseMapper<PartnersEntity> {
List<PartnersEntity> selectPartnersList(@Param("params") Map<String, Object> params, Page page);
} }
package io.office.modules.manage.service; package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils; import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.PartnersEntity; import io.office.modules.manage.entity.PartnersEntity;
import io.office.modules.sys.entity.SysUserEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -16,5 +20,11 @@ import java.util.Map; ...@@ -16,5 +20,11 @@ import java.util.Map;
public interface PartnersService extends IService<PartnersEntity> { public interface PartnersService extends IService<PartnersEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
R deletePartners(List<Long> ids, SysUserEntity user);
Page<PartnersEntity> selectPartnersList(Map<String, Object> params, Page page);
R verifyPartners(PartnersEntity partnersEntity, SysUserEntity user);
} }
package io.office.modules.manage.service.impl; package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.office.common.utils.R;
import io.office.modules.sys.entity.SysUserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -16,6 +23,8 @@ import io.office.modules.manage.service.PartnersService; ...@@ -16,6 +23,8 @@ import io.office.modules.manage.service.PartnersService;
@Service("partnersService") @Service("partnersService")
public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity> implements PartnersService { public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity> implements PartnersService {
@Autowired
PartnersDao partnersDao;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<PartnersEntity> page = this.page( IPage<PartnersEntity> page = this.page(
...@@ -26,4 +35,34 @@ public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity ...@@ -26,4 +35,34 @@ public class PartnersServiceImpl extends ServiceImpl<PartnersDao, PartnersEntity
return new PageUtils(page); return new PageUtils(page);
} }
@Override
public R deletePartners(List<Long> ids, SysUserEntity user) {
PartnersEntity partnersEntity = new PartnersEntity();
partnersEntity.setUpdatedate(new Date());
partnersEntity.setEditor(user.getUsername());
partnersEntity.setLasteditor(user.getUsername());
partnersEntity.setLevels(0);
QueryWrapper<PartnersEntity> partnersEntityQueryWrapper = new QueryWrapper<>();
partnersEntityQueryWrapper.in("id",ids);
int update = this.baseMapper.update(partnersEntity, partnersEntityQueryWrapper);
if(update>0){
return R.ok("删除成功!");
}else{
return R.error("删除失败!");
}
}
@Override
public Page<PartnersEntity> selectPartnersList(Map<String, Object> params, Page page) {
List<PartnersEntity> list = this.partnersDao.selectPartnersList(params,page);
page.setRecords(list);
return page;
}
@Override
public R verifyPartners(PartnersEntity partnersEntity, SysUserEntity user) {
return null;
}
} }
\ No newline at end of file
...@@ -25,5 +25,32 @@ ...@@ -25,5 +25,32 @@
<result property="checkdate" column="checkdate"/> <result property="checkdate" column="checkdate"/>
</resultMap> </resultMap>
<select id="selectPartnersList" resultMap="partnersMap" parameterType="java.util.Map">
select * from Partners where levels>0
<if test="params.firmname !=null and params.firmname !=''">
and firmname like concat('%',#{params.firmname},'%')
</if>
<if test="params.editor !=null and params.editor !=''">
and editor = #{params.editor}
</if>
<if test="params.status !=null and params.status !=''">
and status = #{params.status}
</if>
<if test="params.technology !=null and params.technology !=''">
and technology = #{params.technology}
</if>
<if test="params.service !=null and params.service !=''">
and service = #{params.service}
</if>
<if test="params.levels !=''">
and levels = #{params.levels}
</if>
<if test="params.releaseTimeStart !=null and params.releaseTimeEnd !=null">
and releasedate BETWEEN #{params.releaseTimeStart} AND #{params.releaseTimeEnd}
</if>
<if test="params.updateTimeStart !=null and params.updateTimeEnd !=null">
and updatedate BETWEEN #{params.updateTimeStart} AND #{params.updateTimeEnd}
</if>
order by id desc
</select>
</mapper> </mapper>
\ No newline at end of file
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