科目信息
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.cwhelp.modules.business.domain;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.common.utils.StatusUtil;
|
||||
import com.cwhelp.modules.system.domain.User;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import lombok.Data;
|
||||
import org.hibernate.annotations.NotFound;
|
||||
import org.hibernate.annotations.NotFoundAction;
|
||||
import org.hibernate.annotations.Where;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name="sys_class_item")
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@Where(clause = StatusUtil.notDelete)
|
||||
public class BssClassItem implements Serializable {
|
||||
// 主键ID
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
// 科目名称
|
||||
private String itemName;
|
||||
// 科目类型
|
||||
private Short itemType;
|
||||
// 数据状态
|
||||
private Byte status = StatusEnum.OK.getCode();
|
||||
// 备注
|
||||
private String remark;
|
||||
// 创建者
|
||||
@CreatedBy
|
||||
@ManyToOne(fetch=FetchType.LAZY)
|
||||
@NotFound(action=NotFoundAction.IGNORE)
|
||||
@JoinColumn(name="create_by")
|
||||
@JsonIgnore
|
||||
private User createBy;
|
||||
// 创建时间
|
||||
@CreatedDate
|
||||
private Date createDate;
|
||||
|
||||
@Transient
|
||||
private String itemTypeName;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.cwhelp.modules.business.repository;
|
||||
|
||||
import com.cwhelp.modules.business.domain.BssClassItem;
|
||||
import com.cwhelp.modules.system.repository.BaseRepository;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
public interface BssClassItemRepository extends BaseRepository<BssClassItem, Long> {
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.cwhelp.modules.business.service;
|
||||
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssClassItem;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
public interface BssClassItemService {
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
Page<BssClassItem> getPageList(Example<BssClassItem> example);
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
BssClassItem getById(Long id);
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param classItem 实体对象
|
||||
*/
|
||||
BssClassItem save(BssClassItem classItem);
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Transactional
|
||||
Boolean updateStatus(StatusEnum statusEnum, List<Long> idList);
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.cwhelp.modules.business.service.impl;
|
||||
|
||||
import com.cwhelp.common.data.PageSort;
|
||||
import com.cwhelp.common.enums.StatusEnum;
|
||||
import com.cwhelp.modules.business.domain.BssClassItem;
|
||||
import com.cwhelp.modules.business.repository.BssClassItemRepository;
|
||||
import com.cwhelp.modules.business.service.BssClassItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huang.jc
|
||||
* @date 2019/12/11
|
||||
*/
|
||||
@Service
|
||||
public class BssClassItemServiceImpl implements BssClassItemService {
|
||||
|
||||
@Autowired
|
||||
private BssClassItemRepository bssClassItemRepository;
|
||||
|
||||
/**
|
||||
* 根据ID查询数据
|
||||
* @param id 主键ID
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public BssClassItem getById(Long id) {
|
||||
return bssClassItemRepository.findById(id).orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表数据
|
||||
* @param example 查询实例
|
||||
* @return 返回分页数据
|
||||
*/
|
||||
@Override
|
||||
public Page<BssClassItem> getPageList(Example<BssClassItem> example) {
|
||||
// 创建分页对象
|
||||
PageRequest page = PageSort.pageRequest();
|
||||
return bssClassItemRepository.findAll(example, page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存数据
|
||||
* @param classItem 实体对象
|
||||
*/
|
||||
@Override
|
||||
public BssClassItem save(BssClassItem classItem) {
|
||||
return bssClassItemRepository.save(classItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态(启用,冻结,删除)/批量状态处理
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public Boolean updateStatus(StatusEnum statusEnum, List<Long> idList) {
|
||||
return bssClassItemRepository.updateStatus(statusEnum.getCode(), idList) > 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user