合同状态修改
This commit is contained in:
parent
484c3b290f
commit
fb9435063c
|
|
@ -29,8 +29,9 @@ public class BmContractController extends BaseController {
|
|||
@ApiOperation(value = "合同列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BmContract bmContract) {
|
||||
startPage();
|
||||
List<BmContract> list = bmContractService.list(bmContract);
|
||||
return AjaxResult.success(list);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
@ApiOperation(value = "合同新增")
|
||||
@PostMapping("/add")
|
||||
|
|
@ -63,4 +64,14 @@ public class BmContractController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "合同状态修改(开启/关闭)")
|
||||
@PostMapping("/updateStatus")
|
||||
public AjaxResult updateStatus(@RequestBody BmContract bmContract) {
|
||||
Integer i = bmContractService.updateStatus(bmContract);
|
||||
if (i > 0){
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,4 +21,8 @@ public interface BmContractMapper {
|
|||
Integer del(BmContract bmContract);
|
||||
|
||||
String selectTaskNumByMonth(@Param("date") Date nowDate);
|
||||
|
||||
Integer updateStatus(BmContract bmContract);
|
||||
|
||||
Integer updateStatusOther(BmContract bmContract);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,4 +18,6 @@ public interface BmContractService {
|
|||
Integer edit(BmContract bmContract);
|
||||
|
||||
Integer del(BmContract bmContract);
|
||||
|
||||
Integer updateStatus(BmContract bmContract);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,6 +97,24 @@ public class BmContractServiceImpl implements BmContractService {
|
|||
return del;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateStatus(BmContract bmContract) {
|
||||
if (bmContract.getStatus() == 0) {
|
||||
// 禁用
|
||||
return bmContractMapper.updateStatus(bmContract);
|
||||
} else {
|
||||
// 开启
|
||||
Integer i = bmContractMapper.updateStatus(bmContract);
|
||||
if (i > 0) {
|
||||
// 其他的禁用
|
||||
bmContract.setOwnerCom(SecurityUtils.getLoginUser().getSysUser().getCompanyId());
|
||||
return bmContractMapper.updateStatusOther(bmContract);
|
||||
} else {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getString() {
|
||||
//根据前台传过来的数据,生成需求编号
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
|
|
|
|||
|
|
@ -16,6 +16,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update_time = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateStatus">
|
||||
update bm_contract set status = #{status} where id = #{id}
|
||||
</update>
|
||||
<update id="updateStatusOther">
|
||||
update bm_contract set status = 0 where owner_com = #{ownerCom} and id != #{id}
|
||||
</update>
|
||||
<delete id="del">
|
||||
delete from bm_contract where id = #{id}
|
||||
</delete>
|
||||
|
|
|
|||
Loading…
Reference in New Issue