师傅接单区域 Service 和 Mapper
This commit is contained in:
parent
8735f748d5
commit
4355e6dc91
|
|
@ -24,7 +24,7 @@ public class WorkerArea extends BaseEntity {
|
||||||
private Long cityId;
|
private Long cityId;
|
||||||
|
|
||||||
@Excel(name = "区县区域id", cellType = Excel.ColumnType.NUMERIC)
|
@Excel(name = "区县区域id", cellType = Excel.ColumnType.NUMERIC)
|
||||||
private Long countryId;
|
private Long districtId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ghy.worker.mapper;
|
||||||
|
|
||||||
|
import com.ghy.worker.domain.WorkerArea;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师父接单区域
|
||||||
|
*
|
||||||
|
* @author HH 2022/6/6
|
||||||
|
*/
|
||||||
|
public interface WorkerAreaMapper {
|
||||||
|
|
||||||
|
int insert(WorkerArea workerArea);
|
||||||
|
|
||||||
|
int delete(Long workerAreaId);
|
||||||
|
|
||||||
|
int deleteByWorker(Long workerId);
|
||||||
|
|
||||||
|
WorkerArea getByWorker(Long workerId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ghy.worker.service;
|
||||||
|
|
||||||
|
import com.ghy.worker.domain.WorkerArea;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 师父接单区域
|
||||||
|
*
|
||||||
|
* @author HH 2022/6/6
|
||||||
|
*/
|
||||||
|
public interface WorkerAreaService {
|
||||||
|
|
||||||
|
int insert(WorkerArea workerArea);
|
||||||
|
|
||||||
|
int delete(Long workerAreaId);
|
||||||
|
|
||||||
|
int deleteByWorker(Long workerId);
|
||||||
|
|
||||||
|
WorkerArea getByWorker(Long workerId);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ghy.worker.service.impl;
|
||||||
|
|
||||||
|
import com.ghy.worker.domain.WorkerArea;
|
||||||
|
import com.ghy.worker.mapper.WorkerAreaMapper;
|
||||||
|
import com.ghy.worker.service.WorkerAreaService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class WorkerAreaServiceImpl implements WorkerAreaService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WorkerAreaMapper workerAreaMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insert(WorkerArea workerArea) {
|
||||||
|
return workerAreaMapper.insert(workerArea);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int delete(Long workerAreaId) {
|
||||||
|
return workerAreaMapper.delete(workerAreaId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByWorker(Long workerId) {
|
||||||
|
return workerAreaMapper.deleteByWorker(workerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WorkerArea getByWorker(Long workerId) {
|
||||||
|
return workerAreaMapper.getByWorker(workerId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ghy.worker.mapper.WorkerAreaMapper">
|
||||||
|
|
||||||
|
<resultMap id="WorkerAreaResult" type="com.ghy.worker.domain.WorkerArea">
|
||||||
|
<result property="workerAreaId" column="worker_area_id"/>
|
||||||
|
<result property="workerId" column="worker_id"/>
|
||||||
|
<result property="provinceId" column="province_id"/>
|
||||||
|
<result property="cityId" column="city_id"/>
|
||||||
|
<result property="districtId" column="district_id"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.ghy.worker.domain.WorkerArea" useGeneratedKeys="true" keyProperty="workerAreaId">
|
||||||
|
INSERT INTO worker_area(
|
||||||
|
<if test="workerId != null and workerId > 0">worker_id,</if>
|
||||||
|
<if test="provinceId != null and provinceId > 0">province_id,</if>
|
||||||
|
<if test="cityId != null and cityId > 0">city_id,</if>
|
||||||
|
<if test="districtId != null and districtId > 0">district_id,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
create_time
|
||||||
|
)VALUES(
|
||||||
|
<if test="workerId != null and workerId > 0">#{workerId},</if>
|
||||||
|
<if test="provinceId != null and provinceId > 0">#{provinceId},</if>
|
||||||
|
<if test="cityId != null and cityId > 0">#{cityId},</if>
|
||||||
|
<if test="districtId != null and districtId > 0">#{districtId},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="getByWorker" parameterType="Long" resultMap="WorkerAreaResult">
|
||||||
|
SELECT * FROM worker_area WHERE worker_id = #{workerId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteByWorker" parameterType="Long">
|
||||||
|
DELETE FROM worker_area WHERE worker_id = #{workerId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delete" parameterType="Long">
|
||||||
|
DELETE FROM worker_area WHERE worker_area_id = #{workerAreaId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue