parent
a00f395013
commit
e97c3a89f7
9 changed files with 131 additions and 12 deletions
@ -0,0 +1,15 @@ |
||||
package com.msdw.tms.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.msdw.tms.entity.ExperimentalStudentEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Mapper |
||||
public interface ExperimentalStudentDao extends BaseMapper<ExperimentalStudentEntity> { |
||||
|
||||
List queryIsCode(Integer userId, Integer projectId); |
||||
|
||||
void saveCode(ExperimentalStudentEntity student); |
||||
} |
@ -0,0 +1,21 @@ |
||||
package com.msdw.tms.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
@Data |
||||
@Accessors(chain = true) |
||||
@TableName("tms_experimental_student") |
||||
public class ExperimentalStudentEntity { |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
private Integer id; |
||||
//绑定用户id
|
||||
private Integer userId; |
||||
//绑定项目id
|
||||
private Integer projectId; |
||||
|
||||
} |
@ -0,0 +1,12 @@ |
||||
package com.msdw.tms.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.msdw.tms.entity.ExperimentalStudentEntity; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface ExperimentalStudentService extends IService<ExperimentalStudentEntity> { |
||||
List queryIsCode(Integer userId, Integer projectId); |
||||
|
||||
void saveCode(ExperimentalStudentEntity student); |
||||
} |
@ -0,0 +1,28 @@ |
||||
package com.msdw.tms.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.msdw.tms.dao.ExperimentalStudentDao; |
||||
import com.msdw.tms.entity.ExperimentalStudentEntity; |
||||
import com.msdw.tms.service.ExperimentalStudentService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.List; |
||||
|
||||
@Service("tms_experimental_student") |
||||
public class ExperimentalStudentServiceImpl extends ServiceImpl<ExperimentalStudentDao, ExperimentalStudentEntity> implements ExperimentalStudentService { |
||||
|
||||
@Autowired |
||||
private ExperimentalStudentDao experimentalStudentDao; |
||||
|
||||
@Override |
||||
public List queryIsCode(Integer userId, Integer projectId) { |
||||
List o = experimentalStudentDao.queryIsCode(userId,projectId); |
||||
return o; |
||||
} |
||||
|
||||
@Override |
||||
public void saveCode(ExperimentalStudentEntity student){ |
||||
experimentalStudentDao.saveCode(student); |
||||
} |
||||
} |
@ -0,0 +1,12 @@ |
||||
<?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.msdw.tms.dao.ExperimentalStudentDao"> |
||||
|
||||
<select id="queryIsCode" resultType="Map"> |
||||
SELECT userId FROM tms_experimental_student WHERE userId = #{userId} AND projectId = #{projectId} |
||||
</select> |
||||
|
||||
<insert id="saveCode" parameterType="com.msdw.tms.entity.ExperimentalStudentEntity"> |
||||
INSERT INTO tms_experimental_student(projectId,userId) VALUES (#{projectId},#{userId}) |
||||
</insert> |
||||
</mapper> |
Loading…
Reference in new issue