|
@ -34,10 +34,15 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
|
|
|
* 增加业务类型
|
|
|
* @param json
|
|
|
*/
|
|
|
public void addType(String json) {
|
|
|
public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> addType(String json) {
|
|
|
IotWorkTypeDO iotWorkTypeDO = JSONObject.parseObject(json, IotWorkTypeDO.class);
|
|
|
IotWorkTypeDO workTypeDO = iotWorkTypeDao.findByName(iotWorkTypeDO.getName());
|
|
|
if (workTypeDO!=null){
|
|
|
return MixEnvelop.getError("该业务类型已存在");
|
|
|
}
|
|
|
iotWorkTypeDO.setDel("0");
|
|
|
iotWorkTypeDao.save(iotWorkTypeDO);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_add);
|
|
|
}
|
|
|
|
|
|
|
|
@ -45,14 +50,18 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
|
|
|
* 编辑业务类型
|
|
|
* @param json
|
|
|
*/
|
|
|
public void editType(String json) {
|
|
|
public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> editType(String json) {
|
|
|
IotWorkTypeDO newType = JSONObject.parseObject(json, IotWorkTypeDO.class);
|
|
|
IotWorkTypeDO old = iotWorkTypeDao.findOne(newType.getId());
|
|
|
IotWorkTypeDO workTypeDO = iotWorkTypeDao.findByName(newType.getName());
|
|
|
if (workTypeDO!=null&&(workTypeDO.getId().equalsIgnoreCase(newType.getId())==false)){
|
|
|
return MixEnvelop.getError("该业务类型已存在");
|
|
|
}
|
|
|
old.setName(newType.getName());
|
|
|
old.setExplanation(newType.getExplanation());
|
|
|
old.setDel("0");
|
|
|
old.setId(old.getId());
|
|
|
iotWorkTypeDao.save(old);
|
|
|
return MixEnvelop.getSuccess(IotRequestMapping.WorkType.message_success_edit);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -83,7 +92,7 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 分页查询日志信息
|
|
|
* 分页查询
|
|
|
* @param page
|
|
|
* @param size
|
|
|
* @return
|
|
@ -91,9 +100,11 @@ public class IotWorkTypeService extends BaseJpaService<IotWorkTypeDO, IotWorkTyp
|
|
|
*/
|
|
|
public MixEnvelop<IotWorkTypeDO,IotWorkTypeDO> findAll(Integer page, Integer size) throws ParseException {
|
|
|
|
|
|
String sql = "select * from iot_work_type w where w.del=0;";
|
|
|
StringBuffer sql = new StringBuffer("select * from iot_work_type w where w.del=0 ") ;
|
|
|
|
|
|
sql.append("order by w.update_time desc limit ").append((page-1)*size).append(",").append(size);
|
|
|
|
|
|
List<IotWorkTypeDO> list = jdbcTemplate.query(sql,new BeanPropertyRowMapper(IotWorkTypeDO.class));
|
|
|
List<IotWorkTypeDO> list = jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(IotWorkTypeDO.class));
|
|
|
|
|
|
long count =list.size();
|
|
|
|