Commit 43b7752a authored by wyh's avatar wyh

修改字段

parent a57b6937
......@@ -46,7 +46,6 @@ public class WebShopController {
public ResultInfo<List<Store>> getStoreList(Store store) {
ResultInfo<List<Store>> resultInfo = new ResultInfo<List<Store>>();
store.setIsDeleted(0); //未删除
store.setIsAvailable(1); //店铺启用状态
store.setIsShopping(1); //店铺展示状态
Query q = new Query(store);
PageFinder<Store> pageResult = storeService.getStorePagedList(q);
......
package cn.com.fqy.controller.mgt;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
@Controller
@RequestMapping("worker")
public class WorkerController extends BaseController {
@Resource
private WorkerService workerService;
@Resource
private StoreService storeService;
/*
* 分页展示员工信息
*/
@RequestMapping("workerList")
@ResponseBody
public PageFinder<Worker> workerList(Worker worker,Query query) {
worker.setIsDeleted(0);
Query q = new Query(query.getPageNo(),query.getPageSize(),worker);
return workerService.getWorkerPagedList(q);
}
/**
* 添加或修改员工信息
* @param CarPreiod
* @return
*/
@RequestMapping("addOrEditWorker")
@ResponseBody
public ResultInfo<Worker> addOrEditWorker(Worker worker) {
ResultInfo<Worker> resultInfo = new ResultInfo<>();
if(worker.getStoreId() != null && !"".equals(worker.getStoreId())) {
Store store = storeService.getStore(worker.getStoreId());
if(null != store) {
worker.setStoreName(store.getStoreName());
}
}
//操作人
Operator op = getOperator();
if (worker!=null&&worker.getWorkerId()!=null&&!"".equals(worker.getWorkerId())) {
resultInfo = workerService.updateWorker(worker, op);
}else {
resultInfo = workerService.addWorker(worker, op);
}
return resultInfo;
}
/**
* 员工删除
* @param workerId
* @return
*/
@RequestMapping("delWorker")
@ResponseBody
public ResultInfo<Worker> delWorker(String workerId ) {
ResultInfo<Worker> resultInfo = new ResultInfo<>();
if(workerId == null || "".equals(workerId)) {
resultInfo.setCode("0");
resultInfo.setMsg("员工ID参数为空");
return resultInfo;
}
Worker worker = new Worker();
worker.setIsDeleted(1);
worker.setWorkerId(workerId);
return workerService.updateWorker(worker,getOperator());
}
/**
* 获取员工信息
*/
@RequestMapping("getWorkers")
@ResponseBody
public ResultInfo<List<Worker>> getWorkers(){
ResultInfo<List<Worker>> result = new ResultInfo<>();
Worker worker = new Worker();
worker.setIsDeleted(0);
worker.setIsAuditing(1);
List<Worker> workerList = workerService.getWorkerList(new Query(worker));
if (workerList.size()>0) {
result.setCode("1");
result.setData(workerList);
}else {
result.setCode("0");
result.setMsg("暂无员工数据");
}
return result;
}
}
package cn.com.fqy.controller.mgt;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import cn.com.fqy.common.Operator;
import cn.com.fqy.common.ResultInfo;
import cn.com.fqy.core.common.BaseController;
import cn.com.fqy.core.common.PageFinder;
import cn.com.fqy.core.model.Query;
import cn.com.fqy.core.model.Store;
import cn.com.fqy.core.model.Worker;
import cn.com.fqy.core.service.StoreService;
import cn.com.fqy.core.service.WorkerService;
@Controller
@RequestMapping("worker")
public class WorkerController extends BaseController {
@Resource
private WorkerService workerService;
@Resource
private StoreService storeService;
/*
* 分页展示员工信息
*/
@RequestMapping("workerList")
@ResponseBody
public PageFinder<Worker> workerList(Worker worker,Query query) {
worker.setIsDeleted(0);
Query q = new Query(query.getPageNo(),query.getPageSize(),worker);
return workerService.getWorkerPagedList(q);
}
/**
* 添加或修改员工信息
* @param CarPreiod
* @return
*/
@RequestMapping("addOrEditWorker")
@ResponseBody
public ResultInfo<Worker> addOrEditWorker(Worker worker) {
ResultInfo<Worker> resultInfo = new ResultInfo<>();
if(worker.getStoreId() != null && !"".equals(worker.getStoreId())) {
Store store = storeService.getStore(worker.getStoreId());
if(null != store) {
worker.setStoreName(store.getStoreName());
}
}
//操作人
Operator op = getOperator();
if (worker!=null&&worker.getWorkerId()!=null&&!"".equals(worker.getWorkerId())) {
resultInfo = workerService.updateWorker(worker, op);
}else {
resultInfo = workerService.addWorker(worker, op);
}
return resultInfo;
}
/**
* 员工删除
* @param workerId
* @return
*/
@RequestMapping("delWorker")
@ResponseBody
public ResultInfo<Worker> delWorker(String workerId ) {
ResultInfo<Worker> resultInfo = new ResultInfo<>();
if(workerId == null || "".equals(workerId)) {
resultInfo.setCode("0");
resultInfo.setMsg("员工ID参数为空");
return resultInfo;
}
Worker worker = new Worker();
worker.setIsDeleted(1);
worker.setWorkerId(workerId);
return workerService.updateWorker(worker,getOperator());
}
/**
* 获取员工信息
*/
@RequestMapping("getWorkers")
@ResponseBody
public ResultInfo<List<Worker>> getWorkers(){
ResultInfo<List<Worker>> result = new ResultInfo<>();
Worker worker = new Worker();
worker.setIsDeleted(0);
worker.setIsAuditing(1);
List<Worker> workerList = workerService.getWorkerList(new Query(worker));
if (workerList.size()>0) {
result.setCode("1");
result.setData(workerList);
}else {
result.setCode("0");
result.setMsg("暂无员工数据");
}
return result;
}
}
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