package com.wanma.baseService.ZhaoSheng.model; import com.alibaba.fastjson.JSONObject; import com.jfinal.kit.Kv; import com.jfinal.plugin.activerecord.Db; import com.jfinal.plugin.activerecord.Page; import com.jfinal.plugin.activerecord.Record; import com.jfinal.plugin.activerecord.SqlPara; /** * 作者:黄海 * 时间:2019-09-11 */ public class ZhaoShengModel { /** * 功能:增加人员类型 * 作者:黄海 * 时间:2019-09-11 * @return */ public int addZhaoshengPersonType(String person_type_name,int sort_id) { Record record=new Record(); record.set("person_type_name",person_type_name); record.set("sort_id",sort_id); Db.save("t_zhaosheng_person_type","person_type_id",record); return record.getInt("person_type_id"); } /** * 功能:修改人员类型 * 作者:黄海 * 时间:2019-09-11 * @return */ public void updateZhaoshengPersonType(int person_type_id,String person_type_name,int sort_id) { Record record = Db.findById("t_zhaosheng_person_type", "person_type_id", person_type_id); record.set("person_type_name",person_type_name); record.set("sort_id",sort_id); Db.update("t_zhaosheng_person_type","person_type_id",record); return; } /** * 功能:删除人员类型 * 作者:黄海 * 时间:2019-09-11 * @return */ public void deleteZhaoshengPersonTypeById(int person_type_id) { //Record record = Db.findById("t_zhaosheng_person_type", "person_type_id", person_type_id); //record.set("b_use",0); //Db.update("t_zhaosheng_person_type","person_type_id",record); Db.deleteById("t_zhaosheng_person_type","person_type_id",person_type_id); return; } /** * 功能:获取人员类型分页数据 * 作者:黄海 * 时间:2019-09-11 * @return */ public Page getZhaoshengPersonTypePage(int page,int limit) { //Kv kv=Kv.by("startDate",startDate).set("endDate",endDate); SqlPara sqlPara = Db.getSqlPara("ZhaoSheng.getZhaoshengPersonTypePage"); String sql = sqlPara.getSql(); String totalRowSql = "select count(*) from (" + sql + " ) as t100"; String findSql = "select * from (" + sql + " ) as t100 order by sort_id"; Page pageRecord = Db.paginateByFullSql(page, limit, totalRowSql, findSql); return pageRecord; } /** * 功能:获取人员类型某一条记录信息 * 作者:黄海 * 时间:2019-09-11 * @return */ public Record getZhaoshengPersonTypeById(int person_type_id) { return Db.findById("t_zhaosheng_person_type","person_type_id",person_type_id); } }