删除接口
This commit is contained in:
parent
0b94665c19
commit
9cc19812d6
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.api.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -17,31 +18,35 @@ public class BmCustomer extends BaseEntity implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "")
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 往来单位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "往来单位名称")
|
||||
@Excel(name = "单位名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 往来单位类型
|
||||
*/
|
||||
@ApiModelProperty(value = "往来单位类型")
|
||||
@Excel(name = "单位类型")
|
||||
private Integer typeId;
|
||||
|
||||
/**
|
||||
* 所属分公司
|
||||
*/
|
||||
@ApiModelProperty(value = "所属分公司")
|
||||
@Excel(name = "所属分公司")
|
||||
private Integer companyId;
|
||||
|
||||
/**
|
||||
* 往来单位名称
|
||||
*/
|
||||
@ApiModelProperty(value = "往来单位名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 材料员
|
||||
*/
|
||||
@ApiModelProperty(value = "材料员")
|
||||
@Excel(name = "材料员")
|
||||
private String materialClerk;
|
||||
|
||||
/**
|
||||
|
|
@ -54,6 +59,7 @@ public class BmCustomer extends BaseEntity implements Serializable {
|
|||
* 联系方式
|
||||
*/
|
||||
@ApiModelProperty(value = "联系方式")
|
||||
@Excel(name = "联系电话")
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
|
|
@ -86,5 +92,9 @@ public class BmCustomer extends BaseEntity implements Serializable {
|
|||
@ApiModelProperty(value = "组织分公司id")
|
||||
private String company;
|
||||
|
||||
@ApiModelProperty(value = "状态名称")
|
||||
@Excel(name = "状态")
|
||||
private String statusName;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.base.api.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -27,8 +28,13 @@ public class BmCustomerType extends BaseEntity implements Serializable {
|
|||
* 往来单位类型
|
||||
*/
|
||||
@ApiModelProperty(value="往来单位类型")
|
||||
@Excel(name = "单位类型")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "状态名称")
|
||||
@Excel(name = "状态")
|
||||
private String statusName;
|
||||
|
||||
|
||||
/**
|
||||
* 数据所属组织
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ public class BmAgreementController extends BaseController {
|
|||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@PostMapping(value = "/delete/{id}")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
public ResultBean<String> deleteById(@PathVariable("id") Integer id) {
|
||||
return ResultBean.toIsSuccess(this.bmAgreementService.deleteByPrimaryKey(id), "删除成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 往来单位 信息操作处理
|
||||
|
|
@ -131,6 +132,9 @@ public class BmCustomerController extends BaseController {
|
|||
public void export(HttpServletResponse response, BmCustomer bmCustomer)
|
||||
{
|
||||
List<BmCustomer> list = customerService.selectCustomerList(bmCustomer);
|
||||
list.forEach(item->{
|
||||
item.setStatusName(Objects.equals(item.getIsActive(), "1") ? "启用":"不启用");
|
||||
});
|
||||
ExcelUtil<BmCustomer> util = new ExcelUtil<>(BmCustomer.class);
|
||||
util.exportExcel(response, list, "往来单位列表数据");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,15 +3,19 @@ package com.bonus.base.controller;
|
|||
import com.bonus.base.api.domain.BmCustomerType;
|
||||
import com.bonus.base.service.BmCustomerTypeService;
|
||||
import com.bonus.base.utils.ResultBean;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* (bm_customer_type)往来单位类型表控制层
|
||||
|
|
@ -33,7 +37,7 @@ public class BmCustomerTypeController extends BaseController {
|
|||
@SysLog(title = "往来单位类型", businessType = OperaType.QUERY, logType = 1, module = "往来单位类型->分页查询", details = "往来单位类型列表")
|
||||
public TableDataInfo list(BmCustomerType bmCustomerType) {
|
||||
startPage();
|
||||
List<BmCustomerType> bmCustomerTypeList = bmCustomerTypeService.selectAll();
|
||||
List<BmCustomerType> bmCustomerTypeList = bmCustomerTypeService.selectAll(bmCustomerType);
|
||||
return getDataTable(bmCustomerTypeList);
|
||||
}
|
||||
|
||||
|
|
@ -81,10 +85,25 @@ public class BmCustomerTypeController extends BaseController {
|
|||
* @param id 主键
|
||||
* @return 删除是否成功
|
||||
*/
|
||||
@PostMapping(value = "/del/{id}")
|
||||
@DeleteMapping(value = "/{id}")
|
||||
@RequiresPermissions("base:customerType:remove")
|
||||
public ResultBean<Boolean> deleteById(@PathVariable("id") Integer id) {
|
||||
this.bmCustomerTypeService.deleteByPrimaryKey(id);
|
||||
return ResultBean.success(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出单位类型列表
|
||||
*/
|
||||
@ApiOperation(value = "导出单位类型列表")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BmCustomerType bmCustomerType)
|
||||
{
|
||||
List<BmCustomerType> list = bmCustomerTypeService.selectAll(bmCustomerType);
|
||||
list.forEach(item->{
|
||||
item.setStatusName(Objects.equals(item.getIsActive(), "1") ? "启用":"不启用");
|
||||
});
|
||||
ExcelUtil<BmCustomerType> util = new ExcelUtil<>(BmCustomerType.class);
|
||||
util.exportExcel(response, list, "单位类型列表数据");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,11 +65,10 @@ public class BmSupplierController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "新增供应商管理数据")
|
||||
@PostMapping("/add")
|
||||
public ResultBean<Boolean> add(@RequestBody BmSupplier bmSupplier) {
|
||||
public ResultBean add(@RequestBody BmSupplier bmSupplier) {
|
||||
Long companyId = SecurityUtils.getLoginUser().getSysUser().getCompanyId();
|
||||
bmSupplier.setCompanyId(Integer.parseInt(companyId.toString()));
|
||||
int result = bmSupplierService.insert(bmSupplier);
|
||||
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "新增失败");
|
||||
return bmSupplierService.insert(bmSupplier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -80,9 +79,8 @@ public class BmSupplierController extends BaseController {
|
|||
*/
|
||||
@ApiOperation(value = "编辑供应商管理数据")
|
||||
@PutMapping("/update")
|
||||
public ResultBean<Boolean> edit(@RequestBody BmSupplier bmSupplier) {
|
||||
int result = bmSupplierService.update(bmSupplier);
|
||||
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "修改失败");
|
||||
public ResultBean edit(@RequestBody BmSupplier bmSupplier) {
|
||||
return bmSupplierService.update(bmSupplier);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -92,7 +90,7 @@ public class BmSupplierController extends BaseController {
|
|||
* @return 删除是否成功
|
||||
*/
|
||||
@ApiOperation(value = "删除供应商管理数据")
|
||||
@PostMapping(value = "/delete/{ids}")
|
||||
@PostMapping(value = "/{ids}")
|
||||
public ResultBean<Boolean> deleteById(@PathVariable("ids") Long[] ids) {
|
||||
int result = bmSupplierService.deleteById(ids);
|
||||
return result > 0 ? ResultBean.success(true) : ResultBean.error(0, "删除失败");
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public interface BmCustomerTypeMapper {
|
|||
*/
|
||||
int updateByPrimaryKey(BmCustomerType record);
|
||||
|
||||
List<BmCustomerType> selectAll();
|
||||
List<BmCustomerType> selectAll(BmCustomerType bmCustomerType);
|
||||
|
||||
int updateById(@Param("updated") BmCustomerType updated, @Param("id") Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,5 +55,12 @@ public interface BmSupplierMapper {
|
|||
*/
|
||||
int deleteById(@Param("array") Long[] ids);
|
||||
|
||||
/**
|
||||
* 通过名称查询单条数据
|
||||
*
|
||||
* @param name 名称
|
||||
* @return 实例对象
|
||||
*/
|
||||
BmSupplier queryByName(String name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ public class BmCustomerTypeService{
|
|||
}
|
||||
|
||||
|
||||
public List<BmCustomerType> selectAll() {
|
||||
return bmCustomerTypeMapper.selectAll();
|
||||
public List<BmCustomerType> selectAll(BmCustomerType bmCustomerType) {
|
||||
return bmCustomerTypeMapper.selectAll(bmCustomerType);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.base.service;
|
||||
|
||||
import com.bonus.base.api.domain.BmSupplier;
|
||||
import com.bonus.base.utils.ResultBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -34,7 +35,7 @@ public interface BmSupplierService {
|
|||
* @param bmSupplier 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
int insert(BmSupplier bmSupplier);
|
||||
ResultBean insert(BmSupplier bmSupplier);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
|
|
@ -42,7 +43,7 @@ public interface BmSupplierService {
|
|||
* @param bmSupplier 实例对象
|
||||
* @return 实例对象
|
||||
*/
|
||||
int update(BmSupplier bmSupplier);
|
||||
ResultBean update(BmSupplier bmSupplier);
|
||||
|
||||
/**
|
||||
* 通过主键删除数据
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.bonus.base.service.impl;
|
|||
import com.bonus.base.api.domain.BmSupplier;
|
||||
import com.bonus.base.mapper.BmSupplierMapper;
|
||||
import com.bonus.base.service.BmSupplierService;
|
||||
import com.bonus.base.utils.ResultBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -48,8 +49,14 @@ public class BmSupplierServiceImpl implements BmSupplierService {
|
|||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public int insert(BmSupplier bmSupplier) {
|
||||
return bmSupplierDao.insert(bmSupplier);
|
||||
public ResultBean insert(BmSupplier bmSupplier) {
|
||||
//根据供应商名称去表中查询,判重
|
||||
BmSupplier supplier = bmSupplierDao.queryByName(bmSupplier.getName());
|
||||
if (supplier != null) {
|
||||
return ResultBean.error("供应商名称重复");
|
||||
}
|
||||
int result = bmSupplierDao.insert(bmSupplier);
|
||||
return result > 0 ? ResultBean.success("添加成功") : ResultBean.error("添加失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,8 +66,14 @@ public class BmSupplierServiceImpl implements BmSupplierService {
|
|||
* @return 实例对象
|
||||
*/
|
||||
@Override
|
||||
public int update(BmSupplier bmSupplier) {
|
||||
return bmSupplierDao.update(bmSupplier);
|
||||
public ResultBean update(BmSupplier bmSupplier) {
|
||||
//根据供应商名称去表中查询,判重
|
||||
BmSupplier supplier = bmSupplierDao.queryByName(bmSupplier.getName());
|
||||
if (supplier != null && !supplier.getId().equals(bmSupplier.getId())) {
|
||||
return ResultBean.error("供应商名称重复");
|
||||
}
|
||||
int result = bmSupplierDao.update(bmSupplier);
|
||||
return result > 0 ? ResultBean.success("修改成功") : ResultBean.error("修改失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@
|
|||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from bm_agreement
|
||||
update bm_agreement set is_active = 0
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.bonus.base.api.domain.BmAgreement">
|
||||
|
|
|
|||
|
|
@ -28,12 +28,11 @@
|
|||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from bm_customer
|
||||
<where>
|
||||
where
|
||||
is_active = 1
|
||||
<if test="name != null and name != ''">
|
||||
AND name like concat('%', #{name}, '%')
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
|
@ -81,7 +80,7 @@
|
|||
|
||||
<delete id="deleteCustomerByIds">
|
||||
|
||||
delete from bm_customer where ID in
|
||||
update bm_customer set is_active = 0 where ID in
|
||||
<foreach item="customerId" collection="array" open="(" separator="," close=")">
|
||||
#{customerId}
|
||||
</foreach>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
<!--@mbg.generated-->
|
||||
delete from bm_customer_type
|
||||
update bm_customer_type set is_active = 0
|
||||
where ID = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
|
||||
|
|
@ -93,6 +93,9 @@
|
|||
<include refid="Base_Column_List"/>
|
||||
from bm_customer_type
|
||||
where IS_ACTIVE = '1'
|
||||
<if test="name != null and name != ''">
|
||||
and `NAME` like concat('%',#{name},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="updateById">
|
||||
|
|
|
|||
|
|
@ -49,6 +49,11 @@
|
|||
</if>
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
<select id="queryByName" resultType="com.bonus.base.api.domain.BmSupplier">
|
||||
select id, name, address, company_man, main_person, phone, scope_business, notes, pic_url, is_active, company_id
|
||||
from bm_supplier
|
||||
where name = #{name} and is_active = 1
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
insert into bm_supplier(
|
||||
|
|
|
|||
Loading…
Reference in New Issue