commit
0d012f55de
56 changed files with 1536 additions and 440 deletions
@ -0,0 +1,13 @@ |
||||
package com.msdw.tms.dao; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.msdw.tms.entity.ProjectHiddenEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
@Mapper |
||||
public interface ProjectHiddenDao extends BaseMapper<ProjectHiddenEntity> { |
||||
|
||||
ProjectHiddenEntity selectByProjectId(Integer projectId); |
||||
|
||||
ProjectHiddenEntity selectByTeachId(Integer teachId); |
||||
} |
@ -0,0 +1,34 @@ |
||||
package com.msdw.tms.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.experimental.Accessors; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
@Data |
||||
@ApiModel(value = "此表是在教师端成绩管理,虚仿以及教学列表展示中使用到") |
||||
@TableName("tms_project_hidden") |
||||
public class ProjectHiddenEntity implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "项目id(对应hr_project_management主键)") |
||||
private Integer projectId; |
||||
|
||||
@ApiModelProperty(value = "实验教学id(对应tms_experimental_teaching主键)") |
||||
private Integer teachId; |
||||
|
||||
@ApiModelProperty(value = "是否隐藏(0不隐藏,1隐藏)") |
||||
private Integer isHidden; |
||||
|
||||
|
||||
} |
@ -0,0 +1,7 @@ |
||||
package com.msdw.tms.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.msdw.tms.entity.ProjectHiddenEntity; |
||||
|
||||
public interface ProjectHiddenService extends IService<ProjectHiddenEntity> { |
||||
} |
@ -0,0 +1,18 @@ |
||||
package com.msdw.tms.service.impl; |
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.msdw.tms.dao.ProjectHiddenDao; |
||||
import com.msdw.tms.entity.ProjectHiddenEntity; |
||||
import com.msdw.tms.service.ProjectHiddenService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.Map; |
||||
import java.util.function.Function; |
||||
|
||||
@Service("projectHiddenService") |
||||
public class ProjectHiddenServiceImpl extends ServiceImpl<ProjectHiddenDao, ProjectHiddenEntity> implements ProjectHiddenService { |
||||
|
||||
|
||||
} |
@ -0,0 +1,129 @@ |
||||
package com.msdw.tms.util; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @ProjectName: gzedu |
||||
* @Package: com.huoran.edu.utils |
||||
* @ClassName: ListSub |
||||
* @Description: 集合分页 |
||||
* @Author: Maureen.Rong |
||||
* @CreateDate: 2020/12/3 18:48 |
||||
* @UpdateDate: 2020/12/3 18:48 |
||||
* @Version: 1.0 |
||||
*/ |
||||
public class ListPageUtil<T> { |
||||
/** |
||||
* 原集合 |
||||
*/ |
||||
private List<T> data; |
||||
|
||||
/** |
||||
* 上一页 |
||||
*/ |
||||
private int lastPage; |
||||
|
||||
/** |
||||
* 当前页 |
||||
*/ |
||||
private int nowPage; |
||||
|
||||
/** |
||||
* 下一页 |
||||
*/ |
||||
private int nextPage; |
||||
|
||||
/** |
||||
* 每页条数 |
||||
*/ |
||||
private int pageSize; |
||||
|
||||
/** |
||||
* 总页数 |
||||
*/ |
||||
private int totalPage; |
||||
|
||||
/** |
||||
* 总数据条数 |
||||
*/ |
||||
private int totalCount; |
||||
|
||||
public ListPageUtil(List<T> data, int nowPage, int pageSize) { |
||||
if (data == null || data.isEmpty()) { |
||||
//throw new IllegalArgumentException("暂无数据");
|
||||
this.data = null; |
||||
// this.pageSize = pageSize;
|
||||
// this.nowPage = nowPage;
|
||||
// this.totalCount = data.size();
|
||||
} |
||||
|
||||
this.data = data; |
||||
this.pageSize = pageSize; |
||||
this.nowPage = nowPage; |
||||
this.totalCount = data.size(); |
||||
this.totalPage = (totalCount + pageSize - 1) / pageSize; |
||||
this.lastPage = nowPage - 1 > 1 ? nowPage - 1 : 1; |
||||
this.nextPage = nowPage >= totalPage ? totalPage : nowPage + 1; |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 得到分页后的数据 |
||||
* |
||||
* @return 分页后结果 |
||||
*/ |
||||
public List<T> getPagedList() { |
||||
int fromIndex = (nowPage - 1) * pageSize; |
||||
if (fromIndex >= data.size()) { |
||||
return Collections.emptyList();//空数组
|
||||
} |
||||
if (fromIndex < 0) { |
||||
return Collections.emptyList();//空数组
|
||||
} |
||||
int toIndex = nowPage * pageSize; |
||||
if (toIndex >= data.size()) { |
||||
toIndex = data.size(); |
||||
} |
||||
return data.subList(fromIndex, toIndex); |
||||
} |
||||
|
||||
public int getPageSize() { |
||||
return pageSize; |
||||
} |
||||
|
||||
public List<T> getData() { |
||||
return data; |
||||
} |
||||
|
||||
public int getLastPage() { |
||||
return lastPage; |
||||
} |
||||
|
||||
public int getNowPage() { |
||||
return nowPage; |
||||
} |
||||
|
||||
public int getNextPage() { |
||||
return nextPage; |
||||
} |
||||
|
||||
public int getTotalPage() { |
||||
return totalPage; |
||||
} |
||||
|
||||
public int getTotalCount() { |
||||
return totalCount; |
||||
} |
||||
|
||||
public static void main(String[] args) { |
||||
Integer[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; |
||||
List<Integer> list = Arrays.asList(array); |
||||
|
||||
ListPageUtil<Integer> listPageUtil = new ListPageUtil<Integer>(list, 1, 4); |
||||
List<Integer> pagedList = listPageUtil.getPagedList(); |
||||
System.out.println(pagedList); |
||||
} |
||||
|
||||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,14 @@ |
||||
<?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.ProjectHiddenDao"> |
||||
|
||||
<select id="selectByProjectId" resultType="com.msdw.tms.entity.ProjectHiddenEntity"> |
||||
SELECT is_hidden FROM tms_project_hidden WHERE project_id = #{projectId} |
||||
</select> |
||||
|
||||
<select id="selectByTeachId" resultType="com.msdw.tms.entity.ProjectHiddenEntity"> |
||||
SELECT is_hidden FROM tms_project_hidden WHERE teach_id = #{teachId} |
||||
</select> |
||||
|
||||
</mapper> |
Loading…
Reference in new issue