师傅端登陆 注册
This commit is contained in:
parent
d995af8dfe
commit
000af7f7da
|
|
@ -12,6 +12,8 @@ import com.ghy.customer.domain.Customer;
|
|||
import com.ghy.customer.service.CustomerService;
|
||||
import com.ghy.system.domain.SysDeptConfig;
|
||||
import com.ghy.system.service.ISysDeptConfigService;
|
||||
import com.ghy.worker.domain.Worker;
|
||||
import com.ghy.worker.service.WorkerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -40,6 +42,9 @@ public class WxController extends BaseController {
|
|||
@Autowired
|
||||
private CustomerService customerService;
|
||||
|
||||
@Autowired
|
||||
private WorkerService workerService;
|
||||
|
||||
@PostMapping("/addUser")
|
||||
@ResponseBody
|
||||
public AjaxResult addUser(@RequestBody Customer customer){
|
||||
|
|
@ -66,6 +71,32 @@ public class WxController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@PostMapping("/addWorker")
|
||||
@ResponseBody
|
||||
public AjaxResult addUser(@RequestBody Worker worker){
|
||||
try {
|
||||
int result = workerService.insertWorker(worker);
|
||||
if(result>0){
|
||||
return AjaxResult.success("新增师傅成功");
|
||||
}else {
|
||||
return AjaxResult.warn("新增师傅失败!");
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/getWorkerInfo")
|
||||
@ResponseBody
|
||||
public AjaxResult getUserInfo(@RequestBody Worker worker){
|
||||
try {
|
||||
return AjaxResult.success(workerService.selectByOpenId(worker));
|
||||
}catch (Exception e){
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/token")
|
||||
@ResponseBody
|
||||
public String token(String timestamp, String nonce, String signature, String echostr) throws IOException {
|
||||
|
|
|
|||
|
|
@ -12,4 +12,10 @@ public interface WorkerMapper {
|
|||
*/
|
||||
List<Worker> getWorkerList(Worker worker);
|
||||
|
||||
/**
|
||||
* @param worker 师傅信息
|
||||
* @return 新增成功条数
|
||||
*/
|
||||
int insertWorker(Worker worker);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,5 +12,16 @@ public interface WorkerService {
|
|||
*/
|
||||
List<Worker> getWorkList(Worker worker);
|
||||
|
||||
/**
|
||||
* @param worker 微信唯一id
|
||||
* @return worker师傅
|
||||
*/
|
||||
Worker selectByOpenId(Worker worker);
|
||||
|
||||
/**
|
||||
* @param worker 师傅信息
|
||||
* @return 新增成功条数
|
||||
*/
|
||||
int insertWorker(Worker worker);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
package com.ghy.worker.service.impl;
|
||||
|
||||
import com.ghy.common.utils.StringUtils;
|
||||
import com.ghy.worker.domain.Worker;
|
||||
import com.ghy.worker.mapper.WorkerMapper;
|
||||
import com.ghy.worker.service.WorkerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WorkerServiceImpl implements WorkerService {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private WorkerMapper workerMapper;
|
||||
|
||||
@Override
|
||||
|
|
@ -19,4 +21,19 @@ public class WorkerServiceImpl implements WorkerService {
|
|||
return workerMapper.getWorkerList(worker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Worker selectByOpenId(Worker worker) {
|
||||
List<Worker> list = workerMapper.getWorkerList(worker);
|
||||
if(StringUtils.isNotEmpty(list)){
|
||||
return list.get(0);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertWorker(Worker worker) {
|
||||
return workerMapper.insertWorker(worker);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,5 +34,32 @@
|
|||
<include refid="selectWorker" />
|
||||
</select>
|
||||
|
||||
<insert id="insertWorker" parameterType="com.ghy.worker.domain.Worker" useGeneratedKeys="true" keyProperty="workerId">
|
||||
insert into worker(
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="account != null and account != ''">account,</if>
|
||||
<if test="phone != null and phone != ''">phone,</if>
|
||||
<if test="password != null and password != ''">password,</if>
|
||||
<if test="openId != null and openId != ''">open_id,</if>
|
||||
<if test="deptId != null and deptId != ''">dept_id,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="workerLogoUrl != null and workerLogoUrl != ''">worker_logo_url,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="account != null and account != ''">#{account},</if>
|
||||
<if test="phone != null and phone != ''">#{phone},</if>
|
||||
<if test="password != null and password != ''">#{password},</if>
|
||||
<if test="openId != null and openId != ''">#{openId},</if>
|
||||
<if test="deptId != null and deptId != ''">#{deptId},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="workerLogoUrl != null and workerLogoUrl != ''">#{workerLogoUrl},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue