特殊技能相关接口

This commit is contained in:
HH 2022-06-07 21:51:40 +08:00
parent 5ffaa133a9
commit 8dfb3f0002
10 changed files with 251 additions and 5 deletions

View File

@ -0,0 +1,53 @@
package com.ghy.web.controller.worker;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.text.Convert;
import com.ghy.worker.domain.SpecialSkill;
import com.ghy.worker.service.SpecialSkillService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 特殊技能
*
* @author HH 2022/6/7
*/
@Controller
@RequestMapping("special/skill")
public class SpecialSkillController {
@Resource
private SpecialSkillService specialSkillService;
@PostMapping("list")
@ResponseBody
public AjaxResult list(SpecialSkill specialSkill) {
return AjaxResult.success(specialSkillService.list(specialSkill));
}
@PostMapping("save")
@ResponseBody
public AjaxResult insert(@RequestBody SpecialSkill specialSkill) {
specialSkillService.insert(specialSkill);
return AjaxResult.success("保存成功");
}
@PutMapping("update")
@ResponseBody
public AjaxResult update(@RequestBody SpecialSkill specialSkill) {
specialSkillService.update(specialSkill);
return AjaxResult.success("修改成功");
}
@DeleteMapping("delete")
@ResponseBody
public AjaxResult delete(String ids) {
specialSkillService.delete(Convert.toLongArray(ids));
return AjaxResult.success("保存成功");
}
}

View File

@ -0,0 +1,50 @@
package com.ghy.web.controller.worker;
import com.ghy.common.core.domain.AjaxResult;
import com.ghy.common.core.text.Convert;
import com.ghy.worker.domain.WorkerSpecialSkill;
import com.ghy.worker.service.WorkerSpecialSkillService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 师傅的特殊技能
*
* @author HH 2022/6/7
*/
@Controller
@RequestMapping("worker/special/skill")
public class WorkerSpecialSkillController {
@Resource
private WorkerSpecialSkillService workerSpecialSkillService;
@PostMapping("{workerId}")
@ResponseBody
public AjaxResult getByWorker(@PathVariable Long workerId) {
return AjaxResult.success(workerSpecialSkillService.getByWorker(workerId));
}
@PostMapping("save")
@ResponseBody
public AjaxResult insert(@RequestBody WorkerSpecialSkill workerSpecialSkill) {
workerSpecialSkillService.insert(workerSpecialSkill);
return AjaxResult.success("保存成功");
}
@DeleteMapping
@ResponseBody
public AjaxResult delete(String ids) {
workerSpecialSkillService.delete(Convert.toLongArray(ids));
return AjaxResult.success("保存成功");
}
@DeleteMapping("{workerId}")
@ResponseBody
public AjaxResult deleteByWorker(@PathVariable Long workerId) {
workerSpecialSkillService.deleteByWorker(workerId);
return AjaxResult.success("保存成功");
}
}

View File

@ -5,6 +5,11 @@ import lombok.Data;
import java.time.LocalDate;
/**
* 师傅特殊技能关系表
*
* @author HH 2022/6/7
*/
@Data
public class WorkerSpecialSkill extends BaseEntity {

View File

@ -2,6 +2,8 @@ package com.ghy.worker.mapper;
import com.ghy.worker.domain.SpecialSkill;
import java.util.List;
/**
* 特殊技能Mapper
*
@ -14,4 +16,6 @@ public interface SpecialSkillMapper {
int delete(Long[] ids);
int update(SpecialSkill specialSkill);
List<SpecialSkill> list(SpecialSkill specialSkill);
}

View File

@ -1,6 +1,6 @@
package com.ghy.worker.mapper;
import com.ghy.worker.domain.WorkerArea;
import com.ghy.worker.domain.WorkerSpecialSkill;
import java.util.List;
@ -11,11 +11,11 @@ import java.util.List;
*/
public interface WorkerSpecialSkillMapper {
int insert(WorkerArea workerArea);
int insert(WorkerSpecialSkill workerArea);
int delete(Long[] ids);
int deleteByWorker(Long workerId);
List<WorkerArea> getByWorker(Long workerId);
List<WorkerSpecialSkill> getByWorker(Long workerId);
}

View File

@ -0,0 +1,21 @@
package com.ghy.worker.service;
import com.ghy.worker.domain.SpecialSkill;
import java.util.List;
/**
* 特殊技能Service
*
* @author HH 2022/6/7
*/
public interface SpecialSkillService {
int insert(SpecialSkill specialSkill);
int delete(Long[] ids);
int update(SpecialSkill specialSkill);
List<SpecialSkill> list(SpecialSkill specialSkill);
}

View File

@ -0,0 +1,22 @@
package com.ghy.worker.service;
import com.ghy.worker.domain.WorkerSpecialSkill;
import java.util.List;
/**
* 师傅特殊技能Service
*
* @author HH 2022/6/7
*/
public interface WorkerSpecialSkillService {
int insert(WorkerSpecialSkill workerArea);
int delete(Long[] ids);
int deleteByWorker(Long workerId);
List<WorkerSpecialSkill> getByWorker(Long workerId);
}

View File

@ -0,0 +1,41 @@
package com.ghy.worker.service.impl;
import com.ghy.worker.domain.SpecialSkill;
import com.ghy.worker.mapper.SpecialSkillMapper;
import com.ghy.worker.service.SpecialSkillService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 特殊技能Service
*
* @author HH 2022/6/7
*/
@Service
public class SpecialSkillServiceImpl implements SpecialSkillService {
@Resource
private SpecialSkillMapper specialSkillMapper;
@Override
public int insert(SpecialSkill specialSkill) {
return specialSkillMapper.insert(specialSkill);
}
@Override
public int delete(Long[] ids) {
return specialSkillMapper.delete(ids);
}
@Override
public int update(SpecialSkill specialSkill) {
return specialSkillMapper.update(specialSkill);
}
@Override
public List<SpecialSkill> list(SpecialSkill specialSkill) {
return specialSkillMapper.list(specialSkill);
}
}

View File

@ -0,0 +1,41 @@
package com.ghy.worker.service.impl;
import com.ghy.worker.domain.WorkerSpecialSkill;
import com.ghy.worker.mapper.WorkerSpecialSkillMapper;
import com.ghy.worker.service.WorkerSpecialSkillService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 师傅特殊技能Service
*
* @author HH 2022/6/7
*/
@Service
public class WorkerSpecialSkillServiceImpl implements WorkerSpecialSkillService {
@Resource
private WorkerSpecialSkillMapper workerSpecialSkillMapper;
@Override
public int insert(WorkerSpecialSkill workerArea) {
return workerSpecialSkillMapper.insert(workerArea);
}
@Override
public int delete(Long[] ids) {
return workerSpecialSkillMapper.delete(ids);
}
@Override
public int deleteByWorker(Long workerId) {
return workerSpecialSkillMapper.deleteByWorker(workerId);
}
@Override
public List<WorkerSpecialSkill> getByWorker(Long workerId) {
return workerSpecialSkillMapper.getByWorker(workerId);
}
}

View File

@ -24,7 +24,7 @@
create_time
)VALUES(
<if test="specialSkillName != null and specialSkillName !=''">#{specialSkillName},</if>
<if test="goodsCategoryId != null and goodsCategoryId > 0">#{provinceId},</if>
<if test="goodsCategoryId != null and goodsCategoryId > 0">#{goodsCategoryId},</if>
<if test="dangerous != null">#{dangerous},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="remark != null and remark != ''">#{remark},</if>
@ -36,7 +36,7 @@
UPDATE special_skill
<set>
<if test="specialSkillName != null and specialSkillName !=''">special_skill_name = #{specialSkillName},</if>
<if test="goodsCategoryId != null and goodsCategoryId > 0">goods_category_id = #{provinceId},</if>
<if test="goodsCategoryId != null and goodsCategoryId > 0">goods_category_id = #{goodsCategoryId},</if>
<if test="dangerous != null">dangerous = #{dangerous},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
create_time = sysdate()
@ -50,4 +50,13 @@
</foreach>
</delete>
<select id="list" parameterType="com.ghy.worker.domain.SpecialSkill" resultMap="SpecialSkillResult">
SELECT * FROM special_skill
<where>
<if test="specialSkillId != null and specialSkillId > 0">special_skill_id = #{specialSkillId}</if>
<if test="specialSkillName != null and specialSkillName !=''">special_skill_name = #{specialSkillName}</if>
<if test="goodsCategoryId != null and goodsCategoryId > 0">goods_category_id = #{provinceId}</if>
</where>
</select>
</mapper>