| | |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.crm.common.web.BaseController; |
| | | import com.zy.crm.manager.entity.Cstmr; |
| | | import com.zy.crm.manager.service.CstmrService; |
| | |
| | | EntityWrapper<Cstmr> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | hostEq(wrapper); |
| | | allLike(Cstmr.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} else { |
| | | wrapper.orderBy("create_time", false); |
| | | } |
| | | return R.ok(cstmrService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/cstmr/add/auth") |
| | | @ManagerAuth |
| | | public R add(Cstmr cstmr) { |
| | | cstmr.setHostId(getHostId()); |
| | | Long hostId = getHostId(); |
| | | if (cstmrService.selectByUuid(hostId, cstmr.getUuid()) != null) { |
| | | throw new CoolException("客户已存在"); |
| | | } |
| | | cstmr.setHostId(hostId); |
| | | cstmr.setUuid(cstmrService.getNextUuid(hostId)); // 客户代号 |
| | | cstmr.setDeptId(getDeptId()); // 所属部门 |
| | | cstmr.setUserId(getUserId()); // 所属人员 |
| | | |
| | | cstmr.setCreateBy(getUserId()); |
| | | cstmr.setCreateTime(new Date()); |
| | | cstmr.setUpdateBy(getUserId()); |