Commit 43b7752a authored by wyh's avatar wyh

修改字段

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